Fork me on GitHub
#reitit
<
2019-02-11
>
ro601:02:23

When I specify routes with a - in the name (eg /some-route), the swagger.json ends up converting it to underscores, eg /some_route. Is this intended, or just an artifact of how some intermediate library converts to JSON?

ikitommi14:02:48

quick poke on errors with colors.

insano1015:02:36

Is there a way to provide an example entity in the generated swagger.json for a query/body parameter?

ikitommi16:02:36

@jdommett if you are using clojure.spec, you can wrap the specs into spec-tools.core/spec and set :swagger/example value for it. Example here: https://github.com/metosin/reitit/blob/master/examples/http-swagger/src/example/server.clj#L27-L32

ikitommi16:02:02

for schema, just wrote an issue to support that: https://github.com/metosin/schema-tools/issues/53

👍 5
ikitommi16:02:04

If you know how to do that with pure swagger spesification, you can always write that too. Anything you put under :swagger key is merged directly into the generated spec.

ikitommi16:02:41

e.g. {:swagger {:responses {200 {:examples {"application/json" {:id 1, :name "example"}}}}} would inject an example to 200 response for json.

insano1021:02:36

Ah cool thanks. I was actually gonna try that to see if it worked