Fork me on GitHub
#reitit
<
2022-11-15
>
pavlosmelissinos11:11:26

I'm trying to generate swagger docs for an endpoint. The request payload seems to be wrong though. More info in ๐Ÿงต

pavlosmelissinos12:11:14

This is what the endpoint looks like:

["/foo/:resource/zoo"
    {:post {:handler    resource.zoo/get-resource-zoo
            :parameters {:body ::resource.zoo/body}}
     :name :resource.zoo/get}]
and this is what the generated swagger docs look like:
{
  "metric": "string",
  "dimensions": {
    "additionalProp1": "string",
    "additionalProp2": "string",
    "additionalProp3": "string"
  },
  "date-range": {
    "to": "string",
    "from": "string"
  }
}
1. This json shows up in the swagger ui under a single parameter called body. Expected behaviour: Each of the keys should be a separate body parameter. 2. The swagger json that reitit generates has "body" nested under "parameters". Expected behaviour: It should be under "requestBody", next to "parameters" I'm not sure if I've made a mistake or if it's a bug or something, so I'd appreciate some help, thanks! edit: the stack is pedestal + reitit + spec

pavlosmelissinos12:11:06

On closer inspection, requestBody seems to be an OpenAPI 3.0 feature which reitit doesn't support yet ๐Ÿ˜ž

pavlosmelissinos12:11:05

ฮ™ can see there's an https://github.com/metosin/reitit/pull/563 that adds support for OpenAPI 3.0. The last activity was ~2 months ago but I'd love to have this in master, so are there any plans to merge it, or even reasons not to? ๐Ÿ™‚

Apple13:11:10

If you think the PR is ready, you can just get the files and save them to your src/. Of course in your classpath src/ has to be closer to the front.

pavlosmelissinos13:11:53

Thanks for the suggestion but if someone from metosin plans to take a look at the PR, I'd much rather stay on OpenAPI 2 for a while and wait to get proper support than try to hack it together. It's obviously ok if the metosin team is too busy right now, I'm only asking to manage my expectations before I decide what to do with the problem (e.g. stay on OpenAPI 2.0, write yaml, fork reitit, etc).

pavlosmelissinos12:11:05

ฮ™ can see there's an https://github.com/metosin/reitit/pull/563 that adds support for OpenAPI 3.0. The last activity was ~2 months ago but I'd love to have this in master, so are there any plans to merge it, or even reasons not to? ๐Ÿ™‚