Fork me on GitHub
#reitit
<
2019-09-04
>
Per Weijnitz14:09:04

Hi! I'm trying to learn reitit, but I can't figure out how to give response models sensible names. Swagger defaults to "inline_model", but I'd want to name them myself somehow. Is there an easy way to do this in the service route structure? Enclosing a simple service with a response model name that defaults to "inline_model" for /api/test.

Per Weijnitz16:09:26

or put another way: how do I get reitit to insert "title": "CustomName" in the "responses": { "200": { "schema": { ... structure?

jahson17:09:59

Is it possible in OpenAPI somehow?

ikitommi18:09:31

@per.weijnitz272 welcome! Clojure.spec doesn't still support spec metadata, but you can use spec-tools for that. The spec :name gets copied to :title in the JSON Schema

ikitommi18:09:56

Hope this helps

Per Weijnitz18:09:40

@ikitommi Amazing, just amazing! Many thanks for the great explanation!