-
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
Allow anyOf in specification #377
Comments
A big part of what I liked about swagger 1 was that I could re-used my json-schema validation as my model definitions. That went away with swagger 2.0 |
Actually, we necessarily need to support it. While strictly speaking, Swagger is the specification, the specification itself means nothing without proper tooling support. While you may not be looking it, once we put it in, users would start asking for it (and rightfully so). This is true for other features that are not yet fully implemented in the tools (though are easier to implement). We're trying to think of ways to add support for anyOf in the future though. |
Just as a use-case here. We use a Swagger file to define our API so that we get pretty documentation, etc.. This works great. We have the need to use an anyOf - so right now we we provide a "dummied up" schema that is "pretty close" but not correct. Then we document that in the Swagger doc parts. At runtime, we point to a different place inside the Swagger.json file that is using anyOf (because our any of is making references we keep all of the JSON Schema in the same file). Anyway while I realize it will be a long time if ever a code-generation tool could support that, we do our server in JS (and clients too). So just throwing it out there that we use Swagger, and anyOf support would be great, as we have a slightly awkward work-around. |
Tackling PR: #741 |
This has been merged. |
We don't necessarily need to support anyOf for tooling.
I know the code generation authors like the definition of type hierarchy that comes with allOf inheritance.
But it would be so nice to be able to specify an anyOf array.
Even if swagger spec validation just ignored it that would be an improvement.
It seems so restrictive to disallow certain types of schema validation just because tool authors aren't supporting it.
:-/
The text was updated successfully, but these errors were encountered: