Generate docs + client schemas

Generate docs and OpenAPI output from ContractSpec operations to power SDKs, docs sites, and tooling.

What you'll build

  • Export docs from your specs.
  • Emit OpenAPI 3.1 for client SDK generation.
  • Keep outputs deterministic with CI validation.

1) Generate docs

Use the generator to emit docs from your contracts.

generate-docs
contractspec generate

Expected output: Generate X doc files in generated/docs.

2) Export OpenAPI

Export an OpenAPI document from your registry module.

openapi-export
contractspec openapi export --registry ./src/contracts/registry.ts --out ./generated/openapi.json

Expected output: OpenAPI written to .../generated/openapi.json.

3) Validate specs

validate-specs
contractspec validate

Expected output: Validation passed.

Example package

The Integration Hub example provides a full registry of operations and is a good source for OpenAPI exports.

integration-hub-example
contractspec examples show integration-hub

# openapi export against your registry module
contractspec openapi export --registry ./src/contracts/registry.ts --out ./generated/openapi.json

Want managed schema releases?

Studio can publish OpenAPI, SDKs, and release notes automatically with approvals.

Join Studio waitlist