@usedispatch/atproto-lexicon
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

@atproto/lexicon: schema validation library

TypeScript implementation of the Lexicon data and API schema description language, which is part of atproto.

NPM Github CI Status

Usage

import { Lexicons } from '@atproto/lexicon'

// create your lexicons collection
const lex = new Lexicons()

// add lexicon documents
lex.add({
  lex: 1,
  id: 'com.example.post',
  defs: {
    // ...
  }
})

// validate
lex.assertValidRecord('com.example.record', {$type: 'com.example.record', ...})
lex.assertValidXrpcParams('com.example.query', {...})
lex.assertValidXrpcInput('com.example.procedure', {...})
lex.assertValidXrpcOutput('com.example.query', {...})

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @usedispatch/atproto-lexicon

Weekly Downloads

2

Version

0.3.0

License

MIT

Unpacked Size

3 MB

Total Files

49

Last publish

Collaborators

  • andrew_dispatch
  • zfaizal
  • viksit_
  • fastestmannr