Skip to content
Last updated

Redoc CE specification extensions

OpenAPI and AsyncAPI allow specification extensions: custom fields that start with x- and that tools can interpret. This page lists the extensions Redoc CE reads and renders.

Redoc CE ignores all other extensions. The ignored extensions include the extensions that depend on the Redocly platform, such as x-rbac, x-seo, x-metadata, x-keywords, x-hideReplay, x-usePkce, and x-assertionType.

To display custom x- fields as plain text in the documentation, set the showExtensions option. With showExtensions: true, Redoc CE displays every extension it does not read itself and keeps the Redocly-only fields x-keywords, x-metadata, and x-usePkce hidden. To display Redocly-only fields, list them explicitly: showExtensions: ['x-seo', 'x-metadata'].

OpenAPI extensions

ExtensionDescription
x-additionalPropertiesNameDisplay a field name for an additionalProperties description.
x-badgesAdd visible badges to API operations.
x-codeSamplesProvide the code samples to display for an operation. Redoc CE displays these samples and the payload sample, and does not generate samples for other languages. A sample appears only when its label, or its lang when it has no label, is in the codeSamples language list.
x-displayNameUse a human-friendly display name for a tag.
x-enumDescriptionsAdd readable labels for enum values.
x-explicitMappingOnlySet on a schema with a discriminator to list only the schemas named in discriminator.mapping, and hide schemas matched implicitly.
x-logoDisplay a logo at the top of the sidebar. Set info.x-logo with url (image URL), and optionally href (link target, defaults to info.contact.url), altText, and backgroundColor.
x-mcpDocument MCP servers and tools, and display the connect buttons on the overview page.
x-summaryAdd a short summary of a response.
x-tagGroupsGroup tags in the sidebar.
x-tagsAdd individual schemas to navigation sections alongside operations.
x-traitTagMark tags that label operations instead of grouping them.
x-webhooksAdd webhooks to OpenAPI 3.0 and older descriptions.

Swagger 2.0 extensions

Redoc CE converts Swagger 2.0 descriptions to OpenAPI 3 before rendering, and reads the following extensions on the way:

  • x-examples: add examples to a request, like the OpenAPI 3 example and examples keywords.
  • x-nullable: mark a schema as nullable.
  • x-servers: add one or more target hosts for the API.

AsyncAPI extensions

ExtensionDescription
x-additionalPropertiesNameDisplay a field name for an additionalProperties description.
x-badgesAdd visible badges to operations.
x-enumDescriptionsAdd readable labels for enum values.
x-logoDisplay a logo at the top of the sidebar, with the same info.x-logo fields as for OpenAPI.
x-tagGroupsGroup tags in the sidebar.

GraphQL

GraphQL schemas have no extension mechanism. Redoc CE renders the schema definition language as is, and takes the overview metadata from the info option.

Security definitions injection

Redoc CE 3.x ignores the <!-- Redoc-Inject: <security-definitions> --> comment that Redoc CE 2.x used to place the security schemes section in info.description. Instead, each operation displays its security requirements through a View security details action. You can remove the comment from info.description.

Resources