-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not clear how to describe a “flag” parameter in OpenAPI #1782
Comments
Related: Support for arbitrary query strings |
The example I gave above doesn't illustrate well that the query string of the URLs does follow “form encoded” syntax for parameters that take a value. To extend the example: |
…rameter objects, marking the parameter as a flag parameter (see: OAI/OpenAPI-Specification#1782).
For now, I've resorted to using a specification extension and added support for it to swagger-ui (Yesplan/swagger-ui@21e3e9d). Here's an attempt to describe it as an extension of the OpenAPI specification for parameter objects:
Or at least the above is how I initially thought about it, but I now realize it might make more sense to say that |
A specification extension means whatever you want it to mean, and there's no reason why that should not include enforcing values for other properties. |
Sure, but with an eye on remaining compatible with the non-extended specification, my original proposal (using |
I see. Just another note, on parameters either schema or content is required, but schema can be |
I just ran into this issue as well, a few years later. I'd love to see as part of the specification, either a Or switch |
This is effectively a duplicate of #1502 (Support for arbitrary query strings) because "flag" parameters of this sort are not part of the I've linked this issue to that one and noted the use case, so I'm going to close this so we track the problem in only one place. |
More of a question that an issue report: having gone through the OpenAPI specification, and issue #1573, it's not clear to me how to describe what in issue #1573 is termed a “flag” parameter.
The API I want to describe has some query parameters that can be either present or not present. They do not, and cannot, take a value (also excluding the empty value). So for example,
/mailboxes/inbox/emails
and/mailboxes/inbox/emails?starred
might be valid URLs, but neither/mailboxes/inbox/emails?starred=xyz
nor/mailboxes/inbox/emails?starred=
would be valid URLs.I'm not sure how best to describe a parameter like “starred” in OpenAPI. Should I simply use “allowEmptyValue”, even though its use is, as per issue #1573, not recommended? It also doesn't quite seem to imply “takes no value”.
Am I overlooking something and is there another way to handle this in OpenAPI? Or should I resort to relying on a specification extension of our own?
The text was updated successfully, but these errors were encountered: