Leverage full JSON Schema 2020-12 alignment, describe webhooks, handle nullable with type arrays, use discriminator, and understand $schema usage.
0 / 5 completed
1 / 5
What major change did OpenAPI 3.1 make to JSON Schema alignment?
JSON Schema full alignment: OpenAPI 3.0 used a modified subset of JSON Schema Draft 7, introducing custom keywords (nullable) and removing others ($recursiveRef). OAS 3.1 removes nullable (use type: [string, "null"] or a oneOf with null) and allows any valid JSON Schema 2020-12 keyword, enabling reuse of standard JSON Schema tooling for validation.
2 / 5
What does the webhooks field in OpenAPI 3.1 describe?
Webhooks: the webhooks map uses the same PathItem structure as paths. Each entry describes the HTTP method and schema of the payload your server sends: webhooks: { orderShipped: { post: { requestBody: { content: { "application/json": { schema: { $ref: "#/components/schemas/ShipmentEvent" } } } } } } }. Tools can generate typed webhook handler code from this.
3 / 5
How does OpenAPI 3.1 handle nullable types differently from 3.0?
Nullable in 3.1: OAS 3.0's nullable: true was a non-standard extension that many JSON Schema validators ignored. In OAS 3.1, type: ["string", "null"] is a standard JSON Schema array type union that all compliant validators understand natively, removing the need for special-casing in tooling.
4 / 5
What does the discriminator object in OpenAPI enable?
Discriminator: when an endpoint returns either a Cat or Dog response (oneOf), the discriminator tells clients (and code generators) to inspect the type field of the response to determine which schema to deserialise into. Code generators produce typed union handling; validators know which schema to apply without trying all variants.
5 / 5
What does the $schema keyword in OpenAPI 3.1 schema objects enable?
$schema in OAS 3.1: the top-level OpenAPI document can declare its JSON Schema dialect with "jsonSchemaDialect", and individual schema objects can override with $schema. This enables a document to mix standard JSON Schema 2020-12 schemas with custom dialect schemas, giving tools the information needed to validate each schema correctly.