Last updated

OpenAPI extension: x-nullable

Compatibility warning

This specification extension is supported only in OpenAPI 2.0. In OpenAPI 3.0, use nullable. In OpenAPI 3.1, use an array of types and include null in the list.

Use x-nullable in your OpenAPI 2.0 documents to mark schemas with the label Nullable in the API documentation. This indicates that the value of a particular property may be null. Add it to the schema OpenAPI object.

Location

Use the x-nullable extension in an Schema object.

Options

OptionTypeDescription
x-nullablebooleanMarks schema as a nullable.

Examples

The following example show how to mark the country Schema as nullable.

swagger: '2.0'
schemas:
  country:
    type: string
    description: Country of origin
    x-nullable: true

Resources