Skip to content
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

Closed
paulhill opened this issue May 25, 2015 · 5 comments
Closed

Allow anyOf in specification #377

paulhill opened this issue May 25, 2015 · 5 comments

Comments

@paulhill
Copy link
Contributor

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.

:-/

@paulhill
Copy link
Contributor Author

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

@webron
Copy link
Member

webron commented May 26, 2015

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.

@coding2012
Copy link

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.

@webron
Copy link
Member

webron commented Jul 21, 2016

Tackling PR: #741

@fehguy
Copy link
Contributor

fehguy commented Feb 1, 2017

This has been merged.

@fehguy fehguy closed this as completed Feb 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants