Skip to main content

OpenAPI construct matrix

This page is Apiome's fidelity statement for OpenAPI. For every OpenAPI construct, in each of OpenAPI 3.0, 3.1 and 3.2, it says whether the construct survives when you import a document and export it again. The table is not written by hand: a test builds it by running a corpus of documents through Apiome and checking each construct.

What is measured​

Each document in the corpus goes through the same steps a catalog import and export take:

  1. Import the document into Apiome's canonical model.
  2. Export it as OpenAPI, at the document's own version (a 3.0 document as 3.0, and so on).
  3. Re-import the exported file and export it again.
  4. Compare every construct of the original document with both exports.

Each occurrence of a construct gets one of three verdicts:

VerdictMeaning
PreservedThe construct is identical in both exports.
ReportedThe construct changed, and the export's loss report says so.
Silent lossThe construct changed and nothing said so. The test fails on any silent loss.

A cell is Lossless when every occurrence was preserved and Reported when some changed but each change is in the loss report. The count in a cell is the number of occurrences, and how many corpus documents they came from. A dash means the construct does not exist in that version.

The Loss category column says which of the seven loss categories a loss of that construct would fall under: Naming, Type precision, Definitions, Structure, Behaviour, Identity or Placeholders. To read a real export's report, see Understand export fidelity.

The matrix​

ConstructLoss categoryOpenAPI 3.0OpenAPI 3.1OpenAPI 3.2
$self document URIIdentity——✅ Lossless (2 in 2 docs)
jsonSchemaDialectType precision—✅ Lossless (2 in 2 docs)✅ Lossless (2 in 2 docs)
Info contact, licence and terms of serviceDefinitions✅ Lossless (8 in 4 docs)✅ Lossless (9 in 5 docs)✅ Lossless (9 in 5 docs)
info.summaryDefinitions—✅ Lossless (6 in 6 docs)✅ Lossless (6 in 6 docs)
SPDX license.identifierDefinitions—✅ Lossless (4 in 4 docs)✅ Lossless (4 in 4 docs)
Servers and server variables (document, path, operation)Behaviour✅ Lossless (6 in 4 docs)✅ Lossless (5 in 3 docs)✅ Lossless (4 in 3 docs)
Server nameNaming——✅ Lossless (2 in 2 docs)
Tag descriptions and documentsDefinitions✅ Lossless (2 in 2 docs)✅ Lossless (3 in 3 docs)✅ Lossless (3 in 3 docs)
Tag parent, kind and summaryStructure——✅ Lossless (23 in 3 docs)
externalDocsDefinitions✅ Lossless (4 in 1 doc)✅ Lossless (7 in 5 docs)✅ Lossless (7 in 6 docs)
x- specification extensionsDefinitions✅ Lossless (9 in 1 doc)✅ Lossless (22 in 3 docs)✅ Lossless (22 in 3 docs)
Security requirements and schemesBehaviour✅ Lossless (2 in 1 doc)✅ Lossless (8 in 6 docs)✅ Lossless (4 in 4 docs)
Reusable components other than schemasStructure✅ Lossless (9 in 2 docs)✅ Lossless (34 in 17 docs)✅ Lossless (34 in 17 docs)
Path item summary, description, servers and shared parametersStructure✅ Lossless (3 in 1 doc)✅ Lossless (10 in 8 docs)✅ Lossless (11 in 7 docs)
Path item $refStructure✅ Lossless (1 in 1 doc)✅ Lossless (2 in 2 docs)✅ Lossless (2 in 2 docs)
Operation id, summary, description, tags and deprecatedDefinitions✅ Lossless (47 in 7 docs)✅ Lossless (33 in 7 docs)✅ Lossless (38 in 8 docs)
QUERY methodBehaviour——✅ Lossless (3 in 3 docs)
additionalOperations (custom methods)Behaviour——✅ Lossless (2 in 2 docs)
CallbacksBehaviour✅ Lossless (2 in 2 docs)✅ Lossless (3 in 3 docs)✅ Lossless (2 in 2 docs)
WebhooksBehaviour—✅ Lossless (6 in 6 docs)✅ Lossless (4 in 4 docs)
Response linksBehaviour✅ Lossless (5 in 2 docs)✅ Lossless (3 in 3 docs)✅ Lossless (2 in 2 docs)
Parameter style, explode, allowReserved, allowEmptyValue, contentStructure✅ Lossless (7 in 2 docs)✅ Lossless (26 in 6 docs)✅ Lossless (30 in 8 docs)
in: querystring parameterBehaviour——✅ Lossless (2 in 2 docs)
Request body requiredBehaviour✅ Lossless (4 in 3 docs)✅ Lossless (3 in 3 docs)✅ Lossless (3 in 3 docs)
Examples on parameters, media types and headersDefinitions✅ Lossless (11 in 3 docs)✅ Lossless (16 in 6 docs)✅ Lossless (14 in 6 docs)
Several media types on one body or responseStructure✅ Lossless (2 in 1 doc)✅ Lossless (7 in 5 docs)✅ Lossless (8 in 5 docs)
Streaming media types (SSE, JSON Lines, JSON Text Sequences, multipart/mixed)Behaviour✅ Lossless (2 in 1 doc)✅ Lossless (4 in 1 doc)✅ Lossless (5 in 2 docs)
itemSchema for sequential mediaBehaviour——✅ Lossless (5 in 2 docs)
Media type encodingStructure✅ Lossless (1 in 1 doc)✅ Lossless (5 in 4 docs)✅ Lossless (6 in 4 docs)
prefixEncoding and itemEncodingStructure——✅ Lossless (4 in 2 docs)
Response headersBehaviour✅ Lossless (2 in 2 docs)✅ Lossless (3 in 3 docs)✅ Lossless (1 in 1 doc)
Response summaryDefinitions——✅ Lossless (3 in 2 docs)
summary / description beside $refDefinitions—✅ Lossless (5 in 3 docs)✅ Lossless (3 in 2 docs)
discriminatorStructure✅ Lossless (1 in 1 doc)✅ Lossless (2 in 2 docs)✅ Lossless (2 in 2 docs)
allOf, oneOf, anyOf, notStructure✅ Lossless (7 in 2 docs)✅ Lossless (6 in 3 docs)✅ Lossless (5 in 3 docs)
NullabilityType precision✅ Lossless (3 in 1 doc)✅ Lossless (9 in 3 docs)✅ Lossless (7 in 3 docs)
$dynamicRef / $dynamicAnchorStructure—✅ Lossless (2 in 1 doc)✅ Lossless (2 in 1 doc)
JSON Schema 2020-12 keywords (const, prefixItems, if/then/else, …)Type precision—✅ Lossless (34 in 5 docs)✅ Lossless (10 in 5 docs)
Numeric, string, array and object constraintsType precision✅ Lossless (20 in 3 docs)✅ Lossless (22 in 6 docs)✅ Lossless (14 in 6 docs)
Schema formatType precision✅ Lossless (17 in 5 docs)✅ Lossless (16 in 8 docs)✅ Lossless (17 in 7 docs)
Schema readOnly, writeOnly, xml, example, default, deprecated, titleDefinitions✅ Lossless (14 in 3 docs)✅ Lossless (8 in 4 docs)✅ Lossless (24 in 4 docs)

Corpus documents — OpenAPI 3.0: 7, OpenAPI 3.1: 39, OpenAPI 3.2: 40.

Exporting to another version​

The matrix covers exports at a document's own version. When you export to a different version, Apiome converts what the target can hold and reports what it cannot:

  • 3.0 to 3.1 or 3.2: schemas are rewritten into JSON Schema 2020-12. nullable: true becomes a "null" type, and a boolean exclusiveMinimum or exclusiveMaximum takes the bound's number. Nothing is lost.
  • 3.1 or 3.2 to 3.0: 3.1 schema keywords are rewritten into their 3.0 forms where one exists (const becomes a one-value enum, a "null" type becomes nullable). Constructs 3.0 has no place for, such as webhooks, jsonSchemaDialect, $dynamicRef and keywords beside a $ref, are left out, and each one is listed in the loss report.
  • 3.2 to 3.1 or 3.0: 3.2-only constructs, such as $self, itemSchema, in: querystring parameters, tag parent and kind, and response summary, are left out and listed in the loss report. A QUERY operation and custom methods are kept on x-apiome-query-operation and x-apiome-additional-operations extensions.
  • Any version to Swagger 2.0: the file is built from the canonical model only. The loss report says that OpenAPI 3.x constructs such as callbacks, links, webhooks and examples are not written.

Edited operations and schemas​

Apiome keeps a copy of each imported operation and schema, and exports that copy as long as the operation or schema has not changed since import. If it has changed, the export is built from the current version instead. Every source field Apiome has no other place for (callbacks, extensions, discriminator, externalDocs and so on) is still written. The loss report gets one entry for the changed operation or schema, because detail inside the edited fields, such as schema keywords or examples, may be missing.

The corpus​

The corpus is in apiome-rest/tests/fixtures/openapi_construct_corpus:

  • the OpenAPI Initiative's schema test documents for 3.1 and 3.2, from the OpenAPI Specification repository;
  • the OpenAPI Initiative's example documents for 3.0, 3.1 and 3.2, from learn.openapis.org;
  • one Apiome document per version that holds every construct in the matrix.

To add a construct, add it to the catalogue in apiome-rest/src/app/openapi_construct_audit.py and to a corpus document, then regenerate this page:

cd apiome-rest && uv run python scripts/generate_openapi_construct_matrix_doc.py

A cell no corpus document covers shows as Not covered, which also fails the test.