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

allOf should accept Referenced Schema #119

Closed
mossprescott opened this issue Sep 8, 2017 · 2 comments
Closed

allOf should accept Referenced Schema #119

mossprescott opened this issue Sep 8, 2017 · 2 comments

Comments

@mossprescott
Copy link
Contributor

According to the spec, a reference is allowed anywhere a Schema Object can appear, but _schemaAllOf :: Maybe [Schema] means that only an inline schema is accepted for the allOf property.

As far as I can tell, all other Schema properties are typed as Referenced Schema.

The motivating case is a schema which has several UTCTime properties, each with a different description, example, min, etc. our workaround for the time being is to inline the UTCTime schema each time it is used, but I believe allOf is a better way of representing this situation, and experimenting with hand-written swagger.json suggests that SwaggerUI handles it.

Note: I’d be happy to submit a PR changing the type, but it will break any code that uses allOf. Is there any guidance about how to introduce a change like this without too much disruption?

@fizruk
Copy link
Member

fizruk commented Sep 9, 2017

Interestring, I did not think allOf could actually be useful!

Can you share more about the workflow you have (or would like to have) with allOf?

I know about the problem with different descriptions for different fields, but I do not have any good solutions. Except making newtypes with adjusted ToSchema instances (which is unfortunate if you only need to change the description). I think the problem is actually that Swagger does not allow descriptions for fields (not schemas), but that does not make our lives easier :)

I'm happy to accept a PR. I don't think many people use allOf, but it's not a huge change anyway.
People would just have to wrap their schemas in Inline for things to work as before.

@fizruk fizruk closed this as completed in 573b816 Sep 10, 2017
fizruk added a commit that referenced this issue Sep 10, 2017
Allow allOf to accept referenced schemas fix #119
@mossprescott
Copy link
Contributor Author

Nice, thanks, @fizruk and @rodrigosetti!

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

2 participants