Fork me on GitHub
#ring-swagger
<
2018-11-14
>
niels15:11:04

I'm having some trouble getting the :definitions map to appear in swagger.json

niels15:11:41

a little context: checking out 2.0 compojure api with spec coercion

niels15:11:31

for some reason my swagger.json keeps returning empty map definitions: {}

niels15:11:28

maybe it's because I'm not $ref'ing it anywhere

ikitommi16:11:36

@nmdrenard the definitions are extracted automatically from endpoints. I’m not sure it can be overridden via the :swagger options. Would you like to write those manually?

niels16:11:08

What I'm trying to get is the "Models" tab, as can be seen here: https://petstore.swagger.io/

niels16:11:10

scroll to the bottom

niels16:11:27

I've got a couple endpoints, validating with spec, both input and output, so that works (really nicely!) But I'd like to have that "Models" thing too. Maybe this is a swagger-ui 3.0 thing?

ikitommi16:11:42

I think spec-tools doesn’t at the moment support spec references, all models are inlined in the endpoints. Also, this is only visible with the swagger-ui 3.0 (that’s easy to update).

ikitommi16:11:15

Schema/Ring-swagger supports that, just not spec. There is an PR for it, but looks stalled.

ikitommi16:11:45

should be streightforward to collect all the specs with title, ensure they don’t clash, change them to references and put the references under definitions. I personally don’t have time for that, but PR most welcome.

niels16:11:30

link to PR?

niels16:11:55

It's not critical at all, will just instruct users to do an extra click to the endpoints

niels16:11:19

and thanks for helping research!