atproto_openapi

Public API: turn a set of parsed atproto_lexicon/ast.LexiconDoc values into a single OpenAPI 3.1.0 document. See docs/lexicon-openapi.md for the mapping this implements and atproto_openapi/emit for the assembly logic this delegates to. main runs the CLI (atproto_openapi/cli), which walks a directory of lexicon JSON files and writes the generated document to disk.

Types

pub type Error {
  RefError(refs.RefError)
}

Constructors

pub type Generated {
  Generated(
    json: String,
    operation_count: Int,
    schema_count: Int,
    subscriptions_skipped: List(String),
  )
}

Constructors

  • Generated(
      json: String,
      operation_count: Int,
      schema_count: Int,
      subscriptions_skipped: List(String),
    )

Per-run document metadata. A CLI invocation fills this from flags with sane defaults; a library caller builds it directly.

pub type Options {
  Options(title: String, version: String, servers: List(String))
}

Constructors

  • Options(title: String, version: String, servers: List(String))

Values

pub fn generate(
  docs: List(ast.LexiconDoc),
  options: Options,
) -> Result(Generated, Error)

Assemble docs into one OpenAPI 3.1.0 document. Fails only when a ref is malformed or two distinct lexicon refs derive the same components/schemas key; see atproto_openapi/refs. Every other input shape has a defined mapping per the design doc.

pub fn main() -> Nil

gleam run -m atproto_openapi -- <lexicons-dir> <out-file> [--title T] [--version V] [--server URL]. See atproto_openapi/cli.

Search Document