OpenAPI Contract

Serve a generated OpenAPI 3.1 description of the public Dots HTTP surface while stripping internal-only operations.

Overview

Description

The OpenAPI Contract publishes the documented Dots HTTP surface as an OpenAPI 3.1 document at /api/v1/openapi.json. Route modules declare request parameters, bodies, response envelopes, and error outcomes with Zod-backed OpenAPI definitions, and the application generates the document from the same registered routes that handle requests.

Before serving, the generator strips the explicit internal-route roster so operator-only or implementation-control endpoints do not become advertised SDK surface. Census tests compare live routes, documented routes, internal enrollment, and schema coverage, catching a new endpoint that was implemented without documentation or an internal endpoint accidentally exposed in the contract.

Selling Points

  • Gives integrators a machine-readable API catalog for client generation, exploration, and contract testing.
  • Derives documentation from runtime route definitions, reducing drift between prose and actual validation.
  • Keeps internal control endpoints out of the public document through an explicit, tested roster.
  • Describes standard data and error envelopes, helping clients handle Dots APIs consistently.
  • Covers self-hosted and hosted deployments because both serve the same application contract.

User Story

An integration developer points an OpenAPI client generator at their Dots deployment. They receive the public route catalog, including schemas for publications, rows, search, and health, while daemon shutdown and other internal controls are absent. They generate typed client scaffolding and use the document to validate requests against the deployed server.

Extension Surface

This feature is automatable. packages/api/src/openapi.ts serves a stable machine-readable document, and external tools can fetch it in CI, SDK generation, or API explorers. Route authors extend the document inside the repository by registering documented routes. There is no runtime plugin hook for arbitrary OpenAPI fragments, so the feature is not rated pluggable.

Capabilities & Limits

  • Emits OpenAPI 3.1 with request, response, and error schemas for documented routes.
  • Strips the closed INTERNAL_ROUTES roster before returning the public document.
  • Uses route and coverage censuses to detect undocumented or improperly tiered operations.
  • Limit: method-ALL and conditionally mounted control surfaces may intentionally sit outside the documented public catalog.
  • Limit: the document describes HTTP contracts, not business authorization available to a particular credential.

Implementation Map

  • packages/api/src/openapi.ts
  • packages/api/src/routes/index.ts
  • packages/api/src/routes/internal-routes.ts
  • packages/api/src/openapi.census.test.ts
  • packages/api/src/routes/openapi-coverage.census.test.ts

Properties

Property
Value
product
dots-platform
extensibility
automatable
module
SDK, App Shell
packages
api
status
shipped
surface
api
summary
Serve a generated OpenAPI 3.1 description of the public Dots HTTP surface while stripping internal-only operations.

Connections

OpenAPI Contract · Explore connections

  • documented bytoREST API Overview
  • implemented bytopackages/api/src/routes/index.ts
  • implemented bytopackages/api/src/routes/openapi-coverage.census.test.ts
  • implemented bytopackages/api/src/openapi.census.test.ts
  • implemented bytopackages/api/src/openapi.ts
  • implemented bytopackages/api/src/routes/internal-routes.ts
  • complementstoPublish a Dotabase to the Web

Connected Records7

Complements
Documented by
Implemented by
packages/api/src/openapi.census.test.ts
packages/api/src/openapi.ts
packages/api/src/routes/index.ts
packages/api/src/routes/internal-routes.ts
packages/api/src/routes/openapi-coverage.census.test.ts
7 connections.

Documents

Title
Type