API / Swagger Interview questions
What is the difference between OpenAPI 3.0 and OpenAPI 3.1?
OpenAPI 3.1, released after 3.0, focused primarily on aligning the specification's schema syntax much more closely with standard JSON Schema, resolving long-standing incompatibilities that had made some valid JSON Schema constructs unusable in earlier OpenAPI versions.
| OpenAPI 3.0 | OpenAPI 3.1 |
| Schema syntax is a modified subset of JSON Schema Draft 4. | Fully aligned with JSON Schema 2020-12. |
| nullable: true used to indicate a nullable field. | Standard JSON Schema type arrays, e.g. type: [string, null]. |
| No native support for describing webhooks. | Dedicated webhooks top-level object. |
| $ref cannot have sibling keywords merged alongside it. | $ref behaves per standard JSON Schema referencing rules. |
Because 3.1 is closer to standard JSON Schema, teams that already maintain JSON Schema definitions elsewhere (for event payloads, config validation) can often reuse them directly in an OpenAPI 3.1 document with fewer adaptations than 3.0 would have required.
More Related questions...