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.
| Bynk | JSON Schema |
|---|---|
NonEmpty | minLength: 1 |
MinLength(n) | minLength: n |
MaxLength(n) | maxLength: n |
Length(n) | minLength: n, maxLength: n |
Positive | exclusiveMinimum: 0 |
NonNegative | minimum: 0 |
InRange(a, b) | minimum: a, maximum: b |
IsoDate | format: date, minLength: 10, maxLength: 10 |
Cron | x-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 httproute of the project atrootcan answer — the response setbynk openapidocuments, 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 httpservices — every one, or onlyservice(matched asNameorunit.Name). - run
bynk openapi: analyse the project atroot, write the document.- to_yaml
- Render
vas 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.