thim81 / openapi-format

Format an OpenAPI document by ordering, formatting and filtering fields.
MIT License
77 stars 14 forks source link

Issues with cookie parameters being excluded from formatted document #61

Closed bradworsfold-wd closed 1 year ago

bradworsfold-wd commented 1 year ago

Seems that components->parameters->cookies are not supported. In fact, if you add a parameter with in: cookie, the parameter is not included in the output. That is a bit of a head scratcher.

Supported in version 3.0.3 https://swagger.io/docs/specification/describing-parameters/#cookie-parameters

"components": { "parameters": { "JSESSIONID": { "name": "JSESSIONID", "in": "cookie", "required": false, "schema": { "type": "string" } } } }

bradworsfold-wd commented 1 year ago

Looks to be an issue in this block just ignoring cookie based parameters. Would be simple to add. https://github.com/thim81/openapi-format/blob/8a2181bcb75126fa9e88692d7e42d03d885cba48/openapi-format.js#L616-L640

thim81 commented 1 year ago

@bradworsfold-workday Thanks for reporting the issue.

I'll have a look and it should be rather straightforward to add the cookie parameters.

Did I understand your use-case correct? You want to format the OpenAPI document, including the cookie parameters, while instead of being nicely ordered, they are being removed from the formatted result?

bradworsfold-wd commented 1 year ago

Correct. I have a solution for this. I will fork and push it up for you to take a look at.

bradworsfold-wd commented 1 year ago

https://github.com/thim81/openapi-format/pull/62

bradworsfold-wd commented 1 year ago

@thim81 is it possible to review the PR and get this in? Thanks. 🙇

thim81 commented 1 year ago

Hi @bradworsfold-workday

I m this week not near a laptop or pc, but my plan was to review the PR next week and potentially release it next week.

thim81 commented 1 year ago

hi @bradworsfold-workday

I had the time to review and merge your PR. Thanks for taking the time to also update the readme and extend the test.

I'm going to close this issue, since openapi-format version 1.11.0 was just released, which contains your PR for adding support for parameters in Cookies ( #62).