liveBook · Manning

OpenAPI extension

As explained in Automating API Delivery

An OpenAPI extension is a specification-defined mechanism for adding custom fields beginning with x- to an OpenAPI document.

An OpenAPI extension adds custom data to an API definition through fields whose names begin with x-. Extensions can document organization-specific decisions or provide configuration that third-party tools use. API gateways may store declarative deployment settings directly in OpenAPI extensions, keeping them versioned alongside the API definition. section 4.4 section 1.5.5

Use extensions when the standard OpenAPI fields do not express an operational or governance requirement:

  • Mark an exceptional departure from an API style guide and record why the exception is justified. section 5.5.9
  • Supply tool-specific deployment configuration for gateways that interpret vendor extensions. section 1.5.5
  • Control breaking-change analysis by recording lifecycle information such as an endpoint sunset date. section 4.4

Exclude a sunset endpoint from a breaking-change failure

Add x-sunset: "2022-08-30" to a deprecated GET /v1/catalog/categories operation, then run oasdiff breaking apiv1-dep.yaml apiv2.yaml. Because the date is in the past, oasdiff ignores the removed endpoint and reports no breaking change. Removing the extension causes the endpoint removal to be reported. section 4.4

paths:
  /v1/catalog/categories:
    get:
      deprecated: true
      x-sunset: "2022-08-30"
      tags:
        - Categories
      summary: List all categories

Inspect the OpenAPI operation showing deprecated: true alongside an x-sunset date. section 4.4

How Automating API Delivery covers it

How deep it goes
Defines x- field syntax and demonstrates operational uses, but does not specify extension schemas or validation rules.
Examples
Uses gateway vendor configuration, style-guide exception tags, and x-sunset with Tufin/oasdiff.
What it assumes
Assumes OpenAPI definitions and API governance workflows, while defining extension fields from the x- naming pattern.
What you can do after
Operate/configure API workflows by adding x- fields for gateway settings, documented exceptions, or oasdiff lifecycle handling.
How it connects
Connects OpenAPI extensions with API gateways, version control, API style guides, API linting, and breaking-change checks.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Automating API Delivery. The section links point to the parts of the book it draws on.