OpenAPI Format Example

Auto-generated API docs from OpenAPI 3.0 specification

This page demonstrates automatic API documentation generation from an OpenAPI 3.0 specification.

The component automatically detects the format and parses it into our documentation system.

Auto-Detection
The `ApiReference` component automatically detects OpenAPI format when you use `parser="auto"` (the default).

Loading API specification...


About This Example

This example shows how the parser handles:

  • โœ… OpenAPI 3.0 format detection
  • โœ… Schema references ($ref) resolution
  • โœ… Path parameters ({id} converted to :id)
  • โœ… Request/Response schemas with examples
  • โœ… Security schemes (Bearer tokens, API keys)
  • โœ… Multiple response codes (success and errors)

Using Your Own OpenAPI Spec

To use your own OpenAPI specification:

  1. Place your spec file in the /public/api-specs/ directory
  2. Reference it in your MDX file:
Code
mdx
1<ApiReference spec="/api-specs/your-api.json" parser="openapi" />

Or let it auto-detect:

Code
mdx
1<ApiReference spec="/api-specs/your-api.json" />

The parser supports both OpenAPI 3.x and Swagger 2.0 formats.