Documentation

Docs / Command line

graphvein openapi

graphvein openapi [path] [--format json|yaml] [--out file] [--repository ID]
graphvein openapi --project DIR [--repository MEMBER] [--format json|yaml] [--out file]

Writes an OpenAPI 3.1 document of the HTTP routes Graphvein stored for a repository (T029, ADR 0081). It reads the index and graphvein.yaml only: it runs no index, reads no source file, runs no code and opens no network connection. Run graphvein index first; a repository that is not indexed is refused (exit 1).

The same function writes the document of GET /api/v0/openapi and the explorer's download, so the CLI, the server and the UI give the same bytes for one store state.

Options

Option Meaning
path the repository directory (default .); the store is found as for graphvein query (GRAPHVEIN_POSTGRES_URL, else GRAPHVEIN_SQLITE_PATH, else .graphvein/index.db)
--format json JSON, two-space indent, LF, final newline (the default)
--format yaml YAML: the same document with the keys in the same order
--out file write the document to file (atomically) instead of standard output
--repository ID the repository ID, as for graphvein index
--project DIR a project manifest or its directory: write the document of one member (--repository MEMBER, optional when the project has one member), read from the project store, with that member's graphvein.yaml (none for a member without a checkout)

Exit codes: 0 written, 1 not indexed or a read or write error, 2 usage or a graphvein.yaml that does not load.

What the document holds

Every field comes from a row of the claim contract; a field no row names is not written. In short:

Values set by you

A route Graphvein could not place on a path can be placed by stating the missing part in graphvein.yaml (explorer), by hand or from the explorer (a guarded edit, POST /api/v0/explorer/path-values):

version: 1
explorer:
  path_values:
    - key: "route:src/workflows.py#POST%20%2Fworkflows"   # the whole path of one route
      value: /api/v2/workflows
    - key: nextjs_base_path:apps/web                       # a Next.js basePath
      value: /dashboard

The operation is then written with x-graphvein.resolution: set_by_you and an assumption naming the key and value, never as read from code. A value never replaces or displaces a path read from code (it is reported unused with the reason), and it changes only this document, the explorer and try-it. A route key also records the route's registration hash, so a value never silently moves to another registration; see explorer.

Validation

The documents of the golden fixtures and of the corpus check validate against the OpenAPI 3.1 JSON Schema (test-only oracle, see the claim contract's "Validation").

Report a problem with this pageSource: docs/cli/openapi.md