Skip to main content

Module openapi

Module openapi 

Source
Expand description

bynk openapi (#856) — an OpenAPI 3.1 document for a project’s from http services, a lossless re-projection of facts the compiler already holds.

Nothing here re-derives the boundary. Routes and params come from the retained service declarations; each type’s shape comes from the shared wire-contract IR (bynk_check::wire, #855 DECISION C) that also drives the emitter’s codecs and the editor’s wire peek; and each route’s response set is the peek’s body-walked set (bynk_ide::wire_contract, DECISION B), so the spec cannot drift from either.

§Decision A: refinements

Every predicate a boundary type carries is one the codec re-validates, and every one has a JSON Schema equivalent (minLength, minimum, pattern, …). Cross-field predicates (implies) are agent invariants, never wire types, so none reaches this document. Each refined schema still carries the predicates as written in x-bynk-refinements and spells them out in its description, so a consumer reading only the extension, or only the prose, loses nothing.

BynkJSON Schema
NonEmptyminLength: 1
MinLength(n)minLength: n
MaxLength(n)maxLength: n
Length(n)minLength: n, maxLength: n
PositiveexclusiveMinimum: 0
NonNegativeminimum: 0
InRange(a, b)minimum: a, maximum: b
IsoDateformat: date, minLength: 10, maxLength: 10
Cronx-bynk-format: cron, minLength: 9
Matches("p")pattern: "^(?:p)$" (the codec anchors the match)

Structs§

Info
What names the document: the project’s manifest identity.

Enums§

Error
Why a document could not be produced.

Constants§

OPENAPI_VERSION
The OpenAPI version the document declares.

Functions§

declared_statuses
#2685: the statuses each from http route of the project at root can answer — the response set bynk openapi documents, boundary-implicit statuses included — keyed <context> <service> <METHOD> <path>, the key the smoke runner’s typed call names its route by. Empty when the project does not check: a smoke run then has nothing to compare an answer against, and says nothing.
document
Build the OpenAPI document for analysis’ from http services — every one, or only service (matched as Name or unit.Name).
run
bynk openapi: analyse the project at root, write the document.
to_yaml
Render v as block-style YAML. Strings are always double-quoted with JSON’s escapes (a YAML double-quoted scalar), so nothing a schema holds — "true", "1.0", a regex — is read back as another type.