0

I have the following open api schema:

    WaypointEntity:
      type: object
      properties:
        id:
          type: [number, "null"]

But it's not shown correctly in Swagger UI:

enter image description here

Any idea why that is? AmI specifying the types incorrectly? I'm using Open Api 3.0

Helen
  • 87,344
  • 17
  • 243
  • 314
Antonio Gamiz Delgado
  • 1,871
  • 1
  • 12
  • 33

1 Answers1

3

In OpenAPI 3.0, type cannot be a list of types, it must be a single type. A nullable number is defined like this:

id:
  type: number
  nullable: true   # <----

More info: How to define a property that can be string or null in OpenAPI?

Helen
  • 87,344
  • 17
  • 243
  • 314