atproto_codegen/lexicon

Lexicon model + JSON decoding: parse lexicon files into typed defs.

Supports record/object defs with string/integer/number/boolean/array/ref/ cid-link/bytes/blob/unknown fields. A def using anything else (e.g. union, token) becomes Unsupported and is reported, not emitted wrong.

Types

pub type Def {
  Record(nsid: String, properties: List(Property))
  Object(nsid: String, name: String, properties: List(Property))
  Unsupported(nsid: String, name: String, reason: String)
  Ignored
}

Constructors

  • Record(nsid: String, properties: List(Property))
  • Object(nsid: String, name: String, properties: List(Property))
  • Unsupported(nsid: String, name: String, reason: String)
  • Ignored
pub type FieldType {
  TString
  TInt
  TBool
  TNumber
  TRef(String)
  TArray(FieldType)
  TCidLink
  TBytes
  TBlob
  TUnknown
  TUnsupported(String)
}

Constructors

  • TString
  • TInt
  • TBool
  • TNumber
  • TRef(String)
  • TArray(FieldType)
  • TCidLink
  • TBytes
  • TBlob
  • TUnknown
  • TUnsupported(String)
pub type Lexicon {
  Lexicon(nsid: String, defs: List(Def))
}

Constructors

  • Lexicon(nsid: String, defs: List(Def))
pub type Property {
  Property(
    json_name: String,
    field_type: FieldType,
    required: Bool,
  )
}

Constructors

  • Property(
      json_name: String,
      field_type: FieldType,
      required: Bool,
    )

Values

pub fn lexicon_decoder() -> decode.Decoder(Lexicon)
Search Document