Skip to main content

Crate atproto_lexicon

Crate atproto_lexicon 

Source
Expand description

AT Protocol lexicon resolution and validation library.

This library provides functionality for resolving and validating AT Protocol lexicons, which define the schema and structure of AT Protocol data.

§Overview

Lexicons in AT Protocol serve as schema definitions that describe the structure and types of data that can be stored and transmitted. This library implements the full lexicon resolution chain as specified by the AT Protocol:

  1. Convert NSID to DNS name with _lexicon prefix
  2. Perform DNS TXT lookup to get the authoritative DID
  3. Resolve the DID to get the DID document
  4. Extract PDS endpoint from the DID document
  5. Make XRPC call to fetch the lexicon schema

§Modules

  • errors: Structured error types for all lexicon operations
  • resolve: Core lexicon resolution implementation
  • resolve_recursive: Recursive resolution with dependency tracking
  • transmogrify: Record transformation between lexicon schemas
  • [compatibility]: Schema compatibility analysis (requires panproto feature)
  • validation: NSID validation, parsing, and helper functions

§Example Usage

use atproto_lexicon::resolve::{DefaultLexiconResolver, LexiconResolver};
use atproto_identity::resolve::HickoryDnsResolver;

let http_client = reqwest::Client::new();
let dns_resolver = HickoryDnsResolver::create_resolver(&[]);
let resolver = DefaultLexiconResolver::new(http_client, dns_resolver);

// Resolve a lexicon
let lexicon = resolver.resolve("app.bsky.feed.post").await?;

Modules§

errors
Error types for the atproto-lexicon crate.
resolve
Lexicon resolution functionality for AT Protocol.
resolve_recursive
Recursive lexicon resolution functionality for AT Protocol.
transmogrify
Record transmogrification between AT Protocol lexicon schemas.
validation
Lexicon validation functionality for AT Protocol.