OSS-first docs

These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.

OpenAPI export (OpenAPI 3.1) from OperationSpecRegistry

Generate a deterministic OpenAPI document from a OperationSpecRegistry using jsonSchemaForSpec + REST transport metadata.

field.key.label
OpenAPI export (OpenAPI 3.1) from OperationSpecRegistry
field.version.label
field.type.label
field.title.label
OpenAPI export (OpenAPI 3.1) from OperationSpecRegistry
field.description.label

Generate a deterministic OpenAPI document from a OperationSpecRegistry using jsonSchemaForSpec + REST transport metadata.

field.tags.label
contracts,openapi,rest
field.owners.label
field.stability.label
public

OpenAPI export (OpenAPI 3.1) from OperationSpecRegistry

Purpose

ContractSpec specs can be exported into an **OpenAPI 3.1** document for tooling (SDK generation, docs, gateways).

The export is **spec-first**:

Uses `jsonSchemaForSpec(spec)` for input/output JSON Schema (from SchemaModel → zod → JSON Schema)

Uses `spec.transport.rest.method/path` when present

Falls back to deterministic defaults:

Method: `POST` for commands, `GET` for queries

Path: `defaultRestPath(name, version)` → `/<dot/name>/v<version>`

Library API

Function: `openApiForRegistry(registry, options?)`

Location: `@lssm-tech/lib.contracts-spec/openapi`

CLI

Export OpenAPI from a registry module:

contractspec openapi --registry ./src/registry.ts --out ./openapi.json

The registry module must export one of:

`registry: OperationSpecRegistry`

`default(): OperationSpecRegistry | Promise<OperationSpecRegistry>`

`createRegistry(): OperationSpecRegistry | Promise<OperationSpecRegistry>`

Notes / limitations (current)

Responses are generated as a basic `200` response (plus schemas when available).

Query (GET) inputs are currently represented as a JSON request body when an input schema exists.

Errors are not yet expanded into OpenAPI responses; that will be added when we standardize error envelopes.