atproto/lexicon: package for working with lexicon schemas, and runtime data validation (#420)
This is currently a branch on top of
https://github.com/bluesky-social/indigo/pull/407
- [x] parse lexicon schema JSON
- [x] load entire directories of schema JSON files from disk as a
catalog
- [x] check lexicon schema semantics (eg, can't have min greater than
max)
- [x] validate runtime data (`map[string]any`) against lexicons
- [x] whole bunch of corner-case tests
- [x] CLI tool for some live-network testing
- [x] add support for `tid` and `record-key` lex formats (not in specs
yet)
- [x] configurable flexible to legacy blobs and lenient datetime parsing
(?)
- [x] comments and example code
probably in a later iteration:
- [ ] ensure empty body works
(https://github.com/bluesky-social/atproto/pull/2746)
- [ ] validate rkey type against lexicon
- [ ] CLI tool to validate prod firehose
- [ ] CLI tool to validate CAR files
- [x] clarify specs around unions: only `object` and `token` types?
- [x] clarify specs around `unknown`: only `object` type?
- [ ] validate other "primary" lexicon types: subscription, HTTP body,
HTTP URL params, etc