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

Support decode of multiple JSON Schema types (other than null) #211

Open
mattpolzin opened this issue Mar 21, 2021 · 0 comments
Open

Support decode of multiple JSON Schema types (other than null) #211

mattpolzin opened this issue Mar 21, 2021 · 0 comments

Comments

@mattpolzin
Copy link
Owner

OpenAPIKit supports combining the JSON Schema null type with one other type as of #210. This allows us to continue to represent schema nullability in an OpenAPI v3.1 document.

What is missing is the ability to decode other combinations of arbitrarily many JSON Schema types. The JSON Schema spec allows it, so OpenAPI v3.1 allows, so we should be able to decode it. I think one way to support this without making drastic changes to the OpenAPIKit JSONSchema types would be to decode "type": ["string", "number"] as if it were a oneOf -- my hope is we do not lose any expressiveness this way. That will mean that encoding a document having decoded it will result in different structure, but if it is at least comparable in what documentation it represents then I think this is an acceptable area for OpenAPIKit to be opinionated about the encoding of the representation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant