OpenAPI extensions

Beta
View as Markdown
Early access

The CLI generator is in early access. Reach out to get started.

The CLI generator reads several Fern OpenAPI extensions to shape the generated CLI. You can add these extensions directly in your spec or apply them through overlays.

Command structure

x-fern-sdk-group-name

Determines the subcommand group hierarchy. Each list element becomes a nested subcommand, with names converted from camelCase to kebab-case.

openapi.yaml
1paths:
2 /scheduled-events/{uuid}/invitees:
3 get:
4 x-fern-sdk-group-name:
5 - scheduledEvents
6 - invitees
7 x-fern-sdk-method-name: list-event-invitees

Produces: cli scheduled-events invitees list-event-invitees

x-fern-sdk-method-name

Sets the leaf command name (used as-is).

openapi.yaml
1paths:
2 /users/me:
3 get:
4 x-fern-sdk-method-name: get-current-user

Produces: cli get-current-user (or nested under a group if x-fern-sdk-group-name is also set).

If neither extension is present, the CLI falls back to the operationId.

See SDK method names for more details.

Filtering

x-fern-ignore

Excludes operations or parameters from the generated CLI. An ignored operation produces no command; an ignored parameter produces no flag.

openapi.yaml
1paths:
2 /internal/debug:
3 get:
4 x-fern-ignore: true

At the parameter level:

openapi.yaml
1paths:
2 /users:
3 get:
4 parameters:
5 - name: internalParam
6 in: query
7 x-fern-ignore: true
8 schema:
9 type: string

See Ignoring elements for more details.

Availability badges

x-fern-availability

Adds a status badge next to the command in --help output.

ValueBadge
alpha[Alpha]
beta[Beta]
preview[Preview]
generally-available or ga[GA]
deprecated[Deprecated]
legacy[Legacy]
openapi.yaml
1paths:
2 /v2/reports:
3 get:
4 x-fern-availability: beta

OpenAPI’s standard deprecated: true is also honored and maps to [Deprecated] when x-fern-availability isn’t set.

See Availability for more details.

Parameter naming

x-fern-parameter-name

Overrides the CLI flag name derived from a parameter. By default, parameter names are converted to kebab-case for use as flags.

openapi.yaml
1paths:
2 /users:
3 get:
4 parameters:
5 - name: X-API-Version
6 in: header
7 schema:
8 type: string
9 x-fern-parameter-name: api-version

Produces --api-version instead of --x-api-version.

See Customize parameter names for more details.

Pagination

x-fern-pagination

Enables auto-pagination for an endpoint. When present, the CLI recognizes --page-all, --page-limit, and --page-delay flags for that command.

openapi.yaml
1paths:
2 /plants:
3 get:
4 operationId: list_plants
5 x-fern-pagination:
6 cursor: $request.cursor
7 next_cursor: $response.next
8 results: $response.results

See Pagination for all supported pagination schemes (offset, cursor, URI, and path).