Skip to main content

HTTPAPI OpenAPI 3.1 Transcription Profile

Profile Version 0.1 — 20 October 2026 Requires HTTPAPI Version 0.2

Status

This optional profile defines an interoperable transcription from an HTTPAPI contract into an OpenAPI 3.1 document. It does not change the HTTPAPI request, response, runtime, or wire contracts. The key words MUST, MUST NOT, REQUIRED, SHOULD, SHOULD NOT, and MAY have the meanings defined by HTTPAPI Version 0.2. An implementation claiming this profile MUST state:
  • HTTPAPI Version 0.2;
  • OpenAPI 3.1 Transcription Profile Version 0.1;
  • the exact OpenAPI 3.1 patch version emitted; and
  • every declared implementation limit.
The Go reference implementation emits OpenAPI 3.1.1. Another implementation MAY emit a different OpenAPI 3.1 patch version when the output preserves all semantics required by this profile.

1. Document

The document’s openapi property MUST contain the exact OpenAPI 3.1 version emitted. info.version identifies the described API or service version; it is not the HTTPAPI version or this profile version. The title, description, contact, license, terms of service, server URLs, and an optional mounted path prefix are transcription inputs. They are not portable HTTPAPI endpoint-contract properties. The public form of this profile MUST omit internal-only endpoints. A gateway or deployment document that includes internal endpoints is not the public form of this profile and MUST preserve the service-only authorization policy.

2. Routes and operations

Each canonical route and each alias route becomes an operation under its path and lowercase HTTP method. A mounted path prefix, when supplied, is prepended before paths are emitted. operationId is selected in this order:
  1. an explicit alias operation identifier, for an alias;
  2. the canonical endpoint operation identifier;
  3. a generated identifier for the canonical method and path.
A generated identifier starts with the lowercase method. It then appends each non-empty path component after splitting on /, -, _, ., and : and removing surrounding { and }. Components are joined with _. An alias without its own explicit identifier appends Alias to the canonical operation identifier. Operation identifiers MUST be unique within one document; a transcriber MUST reject duplicates. summary contains the declared operation summary. When no summary is declared, it contains the uppercase method, one space, and the mounted path. The following OpenAPI Specification Extensions preserve HTTPAPI operation metadata: An extension MUST be omitted when the corresponding HTTPAPI metadata is not declared.

3. Request bodies

An endpoint without a typed request body omits requestBody. A typed request body emits:
  • required from the HTTPAPI request-body contract;
  • one content member for every normalized accepted media type; and
  • the request shape as the media type’s schema.

4. Responses

Each declared response contract becomes one OpenAPI response. A positive HTTP status is rendered as its decimal status-code key. HTTPAPI status 0 becomes the default response. The response description is the trimmed declared description. When it is empty, the transcriber uses Response.. A typed response body emits its schema under the declared media type; an omitted media type defaults to application/json. When an endpoint declares no response contracts, the transcriber emits one default response with the description Required placeholder response. so that the OpenAPI operation remains structurally valid.

5. Shape mapping

HTTPAPI shapes map to OpenAPI 3.1 Schema Objects as follows: String bounds map to minLength and maxLength. Numeric bounds map to minimum and maximum. Object-property bounds map to minProperties and maxProperties. Array-item bounds map to minItems and maxItems. HTTPAPI bounds are inclusive and the emitted Schema Object MUST preserve that meaning.

6. Discriminated objects

A discriminated request object emits one schema in oneOf for each variant and sets discriminator.propertyName to the discriminator property. Every branch:
  • MUST have type: object when the variant has no more specific object type;
  • MUST define the discriminator property as type: string with the branch’s literal value as its single enum member; and
  • MUST include the discriminator property in required.
Inline branches do not require a discriminator mapping.

7. Presence rules

Presence rules are layered over the ordinary object schema with allOf. An exactly-one rule emits a oneOf whose branches each require one named property. A minimum-presence rule emits an anyOf over every combination of the minimum number of required names. A maximum-presence rule rejects every combination containing one more than the maximum by emitting not schemas with those names in required. When minimum and maximum constraints both apply, all corresponding schemas are included. Independent HTTPAPI rules MUST remain independent Schema Object members; they MUST NOT be collapsed into one larger alternative group.

8. Visibility and limits

The public endpoint form MUST omit internal-only endpoints. OpenAPI 3.1 does not itself define HTTPAPI caller identities or an authorization enforcement model. A transcriber MUST therefore either emit a caller-specific document that filters unavailable properties or declare that its schemas aggregate properties across caller views without encoding their availability. The Go reference transcriber currently emits aggregate response schemas and declares the missing caller-availability annotation as an implementation limit. Its output describes possible payload shapes; it is not an authorization policy. The runtime remains responsible for caller visibility and authorization. If an implementation cannot express a contract feature using the mappings in this profile, it MUST declare that limitation and MUST NOT silently widen the schema. A document generator that intentionally drops a required mapping does not conform to this profile even if the resulting document is valid OpenAPI.

Appendix A. References