Skip to content

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

Closed

Description

@darrelmiller

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.

Activity

  1. MaggieKimani1 commented on Aug 20, 2024

    @MaggieKimani1
    Contributor

    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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions