atproto_sdl

Parse Lexicon SDL source into the atproto_lexicon/ast.LexiconDoc shape, and print it back, so that parse(source, id) |> result.map(print) round-trips. The NSID id is supplied by the caller, derived from the file path (see atproto_sdl/cli).

Values

pub fn main() -> Nil

gleam run -m atproto_sdl -- <src-dir> <out-dir> [--to json|sdl]: convert a directory tree of .sdl/.json files to the other format. See atproto_sdl/cli.

pub fn parse(
  source: String,
  id: String,
) -> Result(ast.LexiconDoc, error.ParseError)
pub fn parse_all(
  sdl_sources: List(#(String, String)),
  json_docs: List(ast.LexiconDoc),
) -> List(#(String, Result(ast.LexiconDoc, error.ParseError)))

Compile a batch of SDL sources (#(nsid, source) pairs) plus already-decoded JSON lexicons against a shared registry, so ... spreads and dotted sugar references resolve across files. Results come back in sdl_sources order, tagged by NSID.

pub fn parse_in_tree(
  source: String,
  id: String,
  known_docs: set.Set(String),
) -> Result(ast.LexiconDoc, error.ParseError)

Parse with workspace knowledge: known_docs are the NSIDs of the other documents compiled in the same tree. See atproto_sdl/lower.

pub fn print(doc: ast.LexiconDoc) -> String
Search Document