# How to test SDK generators on OpenAPI 3.1 before you upgrade

> Run one small OpenAPI 3.1 document through each generator, score what each feature became, and keep any 3.1-to-3.0 downgrade visible in the build.

Source: https://voxgig.com/howto/compare-generators-on-openapi-3-1-support

- Audience: api-producer
- Level: advanced
- Languages: typescript, python
- Verified: 2026-11-30
- Published: 2026-11-30

## Short answer

Write a small OpenAPI 3.1 document that uses type arrays, const, prefixItems and webhooks, run every candidate generator on it, and classify what each feature became: typed, untyped, wrong or missing. In one run, openapi-typescript and Hey API typed every feature, while OpenAPI Generator 7.28.0 left most of them untyped and lost an operation beside the webhook. If you downgrade to 3.0 for one generator, check the result in CI.

---
## You will need

An OpenAPI 3.0 document you plan to upgrade, Node 22 for the table and the checks, and Java for
OpenAPI Generator. Hey API 0.99.0 declares Node 22.18.0 or later in its `engines` field. The
generators ran once in the sample's `record.sh`, which committed trimmed excerpts of what each
wrote, and every result below is computed from those files.

## Approaches compared

| Approach | When it fits | What it costs you | When to pick something else |
| --- | --- | --- | --- |
| [Fern](https://buildwithfern.com/learn/api-definitions/openapi/endpoints/webhooks) | You want hosted SDKs and docs, with 3.1 webhooks as the recommended input | A login, a guest session or Docker to generate, and an unmaintained open source repository | You cannot run Docker and will not send the document to Fern |
| [Hey API](https://heyapi.dev/docs/openapi/typescript/get-started) | TypeScript clients from a 3.1 document, including webhook payload types | A pre-1.0 package, TypeScript only, and Node 22.18.0 or later | You need Python, Java or Go from the same document |
| [Kiota](https://learn.microsoft.com/en-us/openapi/kiota/using) | One tool for C#, Go, Java, Python and TypeScript clients from 3.1 | Runtime packages for every client, and its 3.1 fixes arrive release by release | Your document leans on JSON Schema features its changelog has not mentioned |
| [OpenAPI Generator](https://openapi-generator.tech/docs/generators/typescript-fetch/) | You stay on 3.0, or need a language only it covers | Its README calls 3.1 support beta, and here webhooks cost a real operation | Your 3.1 document has webhooks, tuples or `const` |
| [openapi-typescript](https://openapi-ts.dev/introduction) | Types for a hand-written fetch client, with every 3.1 feature here intact | Types only, so requests, retries and errors stay your code | You want a generated client with methods per operation |
| [Speakeasy](https://www.speakeasy.com/docs/sdks/prep-openapi/best-practices) | An SDK pipeline run from a Speakeasy account, with documentation that recommends 3.1 | An account, and a linter ruleset that always runs before generation | Your policy rules out sending the document to a vendor account |

The two TypeScript-only tools typed every feature in the probe but cover one language. OpenAPI
Generator covers the most languages and read the least of 3.1, so it is the better choice for a
document that stays on 3.0. Kiota, Speakeasy and Fern state 3.1 support in their own
documentation, and this page read it there rather than running them.

## Probe the features 3.0 cannot express

One operation, one webhook, and one schema with four JSON Schema 2020-12 features.[^1] Each
property breaks a 3.0-era assumption in its own way:

```yaml title="api.yaml"
    Order:
      type: object
      required: [id, kind, note, reference, location]
      properties:
        id:
          type: string
        kind:
          description: Always "order", so a client can tell it from a refund.
          const: order
        note:
          description: Free text, or null when the customer left none.
          type: [string, 'null']
        reference:
          description: The customer's own reference, a string or a number.
          type: [string, integer]
        location:
          description: Latitude and longitude, in that order.
          type: array
          prefixItems:
            - type: number
            - type: number
          minItems: 2
          maxItems: 2
          items: false
```

`note` replaces 3.0's [`nullable`](https://spec.openapis.org/oas/v3.0.3.html#fixed-fields-19).
`reference` is a type array with no `null` in it. `location` is a tuple through
[`prefixItems`](https://json-schema.org/draft/2020-12/json-schema-core#name-prefixitems), and the
document's top level carries a [`webhooks`](https://spec.openapis.org/oas/v3.1.0.html#oasWebhooks)
map with one `orderShipped` event.

## Score each generator from its own output

`record.sh` ran OpenAPI Generator 7.28.0 with the `typescript-fetch` and `python` generators,
openapi-typescript 7.13.0 and Hey API 0.99.0, then cut the lines each feature produced into
`excerpts/<generator>/<feature>.txt`. `table.mjs` classifies every excerpt with one rule per
feature, the same for every generator, and stops on an excerpt that is missing or that no rule
reads:

```bash
node table.mjs
```

```text output
feature                       OAG ts-fetch        OAG python          openapi-typescript  Hey API
type: [string, 'null']        typed               typed               typed               typed
type: [string, integer]       untyped             typed               typed               typed
const: order                  untyped             untyped             typed               typed
prefixItems tuple             untyped             untyped             typed               typed
webhooks.orderShipped         wrong               wrong               typed               typed
getOrder beside the webhook   missing             missing             generated           generated
```

OpenAPI Generator typed the nullable field in both languages and the `string | integer` union in
Python only. In TypeScript the union became an empty `OrderReference` interface.
`const` became `any | null` and `Optional[Any]`, and the tuple became `Array<any>` and
`List[Any]`. Every run on the 3.1 document printed `OpenAPI 3.1 support is still in beta`, the same word its
[README at v7.28.0](https://github.com/OpenAPITools/openapi-generator/blob/v7.28.0/README.md)
uses for 3.1.

## Find the operation the webhook displaced

The `wrong` cell means OpenAPI Generator 7.28.0 wrote this document's webhook as a client call to
a path named `/orderShipped`, in the same `DefaultApi` file as `getOrder`. The `typescript-fetch`
and `python` runs both warned `FILEPATH_COLLISION`, and the `DefaultApi` each left holds only the
webhook call. A control run of each generator without the `webhooks` map shows what that cost:

```bash
cat records/control.txt
```

```text output
$ openapi-generator-cli generate -i <work>/no-webhooks.yaml -g typescript-fetch -o <work>/oag-ctl
WARN  o.o.codegen.DefaultCodegen - OpenAPI 3.1 support is still in beta. To report an issue related to 3.1 spec, please kindly open an issue in the Github repo: https://github.com/openAPITools/openapi-generator.
exit 0
$ openapi-generator-cli generate -i <work>/no-webhooks.yaml -g python -o <work>/oag-py-ctl
WARN  o.o.codegen.DefaultCodegen - OpenAPI 3.1 support is still in beta. To report an issue related to 3.1 spec, please kindly open an issue in the Github repo: https://github.com/openAPITools/openapi-generator.
WARN  o.o.codegen.utils.ModelUtils - Failed to get the schema name: null
exit 0
lines naming getOrder in apis/DefaultApi.ts, with webhooks: 0
lines naming getOrder in apis/DefaultApi.ts, without webhooks: 7
files under apis/, with webhooks: DefaultApi.ts index.ts 
lines naming get_order in api/default_api.py, with webhooks: 0
lines naming get_order in api/default_api.py, without webhooks: 10
```

All four runs exited 0, so a pipeline that checks the status alone ships a client with no
`getOrder`. Other generators and other releases of OpenAPI Generator were not tried.
openapi-typescript put the event in a `webhooks` interface, and Hey API wrote an
`OrderShippedWebhookPayload` type and no client call.

## Check the generators you did not run

Kiota added OpenAPI 3.1 support in 1.24.0 and model generation for webhook schemas in 1.35.0,
according to its [changelog](https://github.com/microsoft/kiota/blob/main/CHANGELOG.md). Its
[`kiota generate`](https://learn.microsoft.com/en-us/openapi/kiota/using) command takes the same
probe document with `--language python` or `--language typescript`. Every client it writes needs
Kiota's abstractions package at run time, as its
[dependencies page](https://learn.microsoft.com/en-us/openapi/kiota/dependencies) says. Kiota was
not run for this page, so no cell in the table is Kiota's.

Speakeasy's [guide to preparing a document](https://www.speakeasy.com/docs/sdks/prep-openapi/best-practices)
says it "supports OpenAPI versions 3.0 and 3.1 and recommends OpenAPI version 3.1 for all
projects", and gives JSON Schema compatibility as the reason. Its
[linting page](https://www.speakeasy.com/docs/sdks/prep-openapi/linting) lists `oas3-no-nullable`,
a rule against `nullable` in 3.1 documents. Its CLI asks you to
[authenticate with the Speakeasy Platform](https://www.speakeasy.com/docs/speakeasy-reference/cli/getting-started)
before it generates anything.

Fern's [webhooks page](https://buildwithfern.com/learn/api-definitions/openapi/endpoints/webhooks)
recommends native 3.1 webhooks and says each one needs an `operationId`. Generation takes a
login, a guest session or a local Docker run, as its
[SDK commands page](https://buildwithfern.com/learn/cli-api-reference/cli-reference/sdk-commands)
says. A warning at the top of the README of its
[open source repository](https://github.com/fern-api/fern) says "This open-source project is no
longer maintained" and points to a sign-up instead. Run the probe on either service before you
trust its documentation.

## Check it worked

The suite pins the table, refuses a deleted excerpt, and checks the control run and the
downgrade records:

```bash
node --test generators.test.mjs
```

```text output
1..6
# tests 6
# suites 0
# pass 6
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 138.99779
```

Replacing the OpenAPI Generator `const` excerpt with `kind: 'order';` fails the first test, so
the table depends on what the generator wrote.

## When it goes wrong

The generator you must keep cannot read 3.1, so you downgrade for it. A converter such as
[`openapi-down-convert`](https://github.com/apiture/openapi-down-convert) becomes a step in every
build from then on, so what that step removes needs a check that prints it. `downgrade.mjs` runs that
converter, stamps the 3.0 file with the hash of its 3.1 source, and reports what changed:

```bash
node downgrade.mjs check api.yaml api.3.0.yaml
```

```text output
api.3.0.yaml matches a fresh conversion of api.yaml
dropped by the conversion: /webhooks
3.1 keyword left in the 3.0 file: /components/schemas/Order/properties/location/items: boolean schema
3.1 keyword left in the 3.0 file: /components/schemas/Order/properties/location/prefixItems: prefixItems
3.1 keyword left in the 3.0 file: /components/schemas/Order/properties/reference/type: type array
```

It exits 1. The converter itself exited 0 on the same input. Its README states one rule for type
arrays, which turns a two-member array holding `'null'` into `nullable: true`. It states no rule
for `prefixItems`, so `reference` and the tuple pass through unchanged. OpenAPI Generator 7.28.0 then refused the 3.0
file, as `records/downgraded.txt` shows: `validate` reported four errors and `generate` exited 1. Run the
check in CI, so an edit to `api.yaml` without a fresh conversion fails as `stale`.

## When not to do this

Do not move the spec to 3.1 while a generator you depend on scores `untyped` on features you
need. Staying on 3.0 keeps every generator working, at the price of `nullable` and `enum` where
3.1 would say `null` and `const`.

Do not read this table as a ranking of tools. It measures five features in one document, and a
generator that fails a tuple may still be the only one with the language you ship.

Skip the downgrade if only one generator needs it. Keep that generator on a 3.0 branch of the
document, or replace it, since the conversion drops webhooks and leaves keywords OpenAPI Generator
refuses.

Never trust an exit status alone after an upgrade. Both OpenAPI Generator 7.28.0 runs on this
probe exited 0 with an operation missing.

## Related how-tos

- [Migrate a Swagger 2 document to OpenAPI 3.1](/howto/migrate-swagger-2-to-openapi-3-1)

- [Score SDK generators on your API with a repeatable rubric](/howto/score-sdk-generators-with-a-repeatable-rubric)

- [Check a spec will generate a usable client before merging](/howto/check-a-spec-generates-a-usable-client)

- [Switch SDK generators without breaking published packages](/howto/migrate-from-openapi-generator-without-breaking-packages)

- [Get lint feedback on an OpenAPI file while you edit it](/howto/lint-openapi-while-you-edit)

## Last verified

Verified 2026-11-30 against OpenAPI Generator 7.28.0 on OpenJDK 21, openapi-typescript 7.13.0,
`@hey-api/openapi-ts` 0.99.0 and TypeScript 5.9.3, `@apiture/openapi-down-convert` 0.14.2, and
Node 22.23.5. The generators ran once in `record.sh`. Kiota, Speakeasy and Fern were not run.
Their rows and the section on them come from their own documentation and Kiota's changelog, read
on the same day.

[^1]: OpenAPI 3.1.0 is dated February 15, 2021, and its
[specification](https://spec.openapis.org/oas/v3.1.0.html) bases its data types on JSON Schema
Draft 2020-12, which is where `prefixItems` and the type array come from. The Schema Object of 3.1 has no `nullable`
field. In [3.0.3](https://spec.openapis.org/oas/v3.0.3.html#fixed-fields-19) the `type` field
takes a single string, and `nullable: true` is the field that adds `null` to the allowed type.