Upgrading FastAPI or Springdoc to emit OpenAPI 3.1.0 often breaks existing TypeScript and Zod generators silently—fields start typing as unknown, or runtime validation rejects valid null payloads. Because OpenAPI 3.1 aligned directly with JSON Schema Draft 2020-12, three schema constructs changed shape.
1. nullable: true Was Replaced by Type Arrays
OpenAPI 3.0 used { "type": "string", "nullable": true }. OpenAPI 3.1 drops nullable in favor of standard JSON Schema { "type": ["string", "null"] } (or anyOf). Older 3.0-only generators miss the array form and omit .nullable() in generated Zod schemas.
2. exclusiveMinimum / exclusiveMaximum Changed From Boolean to Number
In 3.0, minimum: 0 paired with exclusiveMinimum: true. In 3.1, exclusiveMinimum: 0 carries the numeric bound directly. Validators expecting booleans either ignore the bound or produce NaN checks.
3. Sibling Keywords Next to $ref
OpenAPI 3.0 ignored sibling properties beside $ref; 3.1 permits description and annotations alongside $ref, which breaks naive reference resolvers.
Zero-Dependency Linter & Client-Side Converters
Because private internal OpenAPI specs shouldn't be uploaded to third-party web converters, I built a small zero-dependency MIT CLI (openapi-zod-lint) plus 0-byte-upload browser converters:
-
Open-Source CLI (
openapi-zod-lint, MIT): https://github.com/JangYS0/openapi-zod-lint - Browser OpenAPI Converter (0B upload): https://global-utils.com/en/openapi-converter
- JSON to Zod Converter: https://global-utils.com/en/json-to-zod
- JSON to TypeScript Converter: https://global-utils.com/en/json-to-ts
Top comments (2)
The nasty part of the nullable change is that nobody touched the API. The team upgrading FastAPI or Springdoc sees the same endpoints and the same fields and ships it as a dependency bump, while the breakage shows up in another team's generated Zod schemas, with fields quietly turning into unknown. From the consumer's side that's a breaking change with no pull request that looks like one, so the spec version ends up being part of the contract whether anyone wrote that down or not.
The nullable to type array change is the one that bites quietly. Generators just drop the null case.