A community based topic aggregation platform built on atproto
1# Lexicon Test Data 2 3This directory contains test data files for validating AT Protocol lexicon schemas. 4 5## Naming Convention 6 7Test files follow a specific naming pattern to distinguish between valid and invalid test cases: 8 9- **Valid test files**: `{type}-valid.json` or `{type}-valid-{variant}.json` 10 - Example: `profile-valid.json`, `post-valid-text.json` 11 - These files should pass validation 12 13- **Invalid test files**: `{type}-invalid-{reason}.json` 14 - Example: `profile-invalid-missing-handle.json`, `post-invalid-enum-type.json` 15 - These files should fail validation 16 - Used to test that the validator correctly rejects malformed data 17 18## Directory Structure 19 20``` 21lexicon-test-data/ 22├── actor/ 23│ ├── profile-valid.json # Valid actor profile 24│ └── profile-invalid-missing-handle.json # Missing required field 25├── community/ 26│ └── profile-valid.json # Valid community profile 27├── interaction/ 28│ └── vote-valid.json # Valid vote record 29├── moderation/ 30│ └── ban-valid.json # Valid ban record 31└── post/ 32 ├── post-valid-text.json # Valid text post 33 └── post-invalid-enum-type.json # Invalid postType value 34``` 35 36## Running Tests 37 38The validator automatically processes all files in this directory: 39- Valid files are expected to pass validation 40- Invalid files (containing `-invalid-` in the name) are expected to fail 41- The validator reports if any files don't behave as expected 42 43```bash 44# Run full validation 45go run cmd/validate-lexicon/main.go 46 47# Run with verbose output to see each file 48go run cmd/validate-lexicon/main.go -v 49``` 50 51## Adding New Test Data 52 53When adding new test data: 54 551. Create valid examples that showcase proper schema usage 562. Create invalid examples that test common validation errors: 57 - Missing required fields 58 - Invalid enum values 59 - Wrong data types 60 - Invalid formats (e.g., bad DIDs, malformed dates) 61 623. Name files according to the convention above 634. Run the validator to ensure your test files behave as expected