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

Handle upcast and downcast of JSON Schemas with multiple types #1786

Closed
darrelmiller opened this issue Aug 20, 2024 · 1 comment · Fixed by #1820
Closed

Handle upcast and downcast of JSON Schemas with multiple types #1786

darrelmiller opened this issue Aug 20, 2024 · 1 comment · Fixed by #1820
Assignees
Milestone

Comments

@darrelmiller
Copy link
Member

In OpenAPI 3.1, JSON Schema can have a type that is an array.

  • If the array has only one value that is not null, treat as if the type was just a string
  • If the array has only one value that is null, in v3/v2 emit as nullable/x-nullable and emit no type
  • If the array has two values where one is null, then in v3/v2 emit as nullable/x-nullable and convert type to string of other value.
  • If the array has two values where neither is null, or more than two values, then in v3/v2 do not emit the type field. By omitting the type field we keep the schema from creating false negatives and it is more likely that downstream tooling will flag the issue.
@MaggieKimani1
Copy link
Contributor

MaggieKimani1 commented Aug 20, 2024

Remove Nullable and represent it as a member of the type array while upcasting

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

Successfully merging a pull request may close this issue.

2 participants