vyrn

std/openapi

1 export, from std/openapi.vyrn.

The contract as an OpenAPI 3.1 document, built from generator imports. openapi(contract) reflects the contract with moduleInterface and returns a module exporting openapiJson() -> String.

import { openapi } from "std/openapi"
import { openapiJson } from openapi("./contract")

The document holds one POST /rpc/<proc> path per procedure in declaration order, with a 200 response and the 422 Issues shape std/rpc returns, and one components/schemas entry per type in the reachable closure, sorted by name. Each schema body is a runtime jsonSchema() call, because moduleInterface carries only a scalar's shallow bounds; each is a compile-time constant, so the document is byte-stable. std/json writes it pretty-printed. No callbacks, webhooks or auth schemes.

Dependencies

The import graph shows the whole library.

Imported by

Tests

4 test blocks in std/openapi.vyrn. CI runs all of them.

Test names
  • oaBaseName strips the path and the .vyrn suffix
  • oaSorted orders names
  • a request schema refs contract types and falls back inline for bare ones
  • oaEscBody escapes quotes and backslashes for a Vyrn literal

Examples

2 programs in examples/ import this module. Each runs as WebAssembly and as a native binary.