Skip to content

Add Lexicon Parser and Code Generator#2

Open
tobbbles wants to merge 1 commit intomainfrom
feature/lexicon-parser-generator
Open

Add Lexicon Parser and Code Generator#2
tobbbles wants to merge 1 commit intomainfrom
feature/lexicon-parser-generator

Conversation

@tobbbles
Copy link
Copy Markdown
Owner

Implements a complete system for parsing ATProto lexicon JSON specifications and generating well-documented Elixir modules.

Features:

  • Lexicon.Parser: Parses lexicon JSON with strict validation per ATProto spec

    • Supports query and procedure types
    • Extracts parameters with constraints (min/max, format, enum, etc.)
    • Validates NSID format and lexicon version
  • Lexicon.Generator: Generates Elixir modules from parsed lexicons

    • Creates comprehensive module and function documentation
    • Generates proper @SPEC annotations
    • Generates correct HTTP implementations (GET for queries, POST for procedures)
    • Formats output code using Code.format_string!/1
  • Mix Task: mix exosphere.gen.lexicon

    • Igniter-based task for interactive code generation
    • Supports --dry-run for previewing changes
    • Custom lexicon and output directories

Test Coverage:

  • 79 tests covering parser, generator, and integration scenarios
  • Test fixtures with realistic lexicon examples

Implements a complete system for parsing ATProto lexicon JSON specifications
and generating well-documented Elixir modules.

Features:
- Lexicon.Parser: Parses lexicon JSON with strict validation per ATProto spec
  - Supports query and procedure types
  - Extracts parameters with constraints (min/max, format, enum, etc.)
  - Validates NSID format and lexicon version

- Lexicon.Generator: Generates Elixir modules from parsed lexicons
  - Creates comprehensive module and function documentation
  - Generates proper @SPEC annotations
  - Generates correct HTTP implementations (GET for queries, POST for procedures)
  - Formats output code using Code.format_string!/1

- Mix Task: mix exosphere.gen.lexicon
  - Igniter-based task for interactive code generation
  - Supports --dry-run for previewing changes
  - Custom lexicon and output directories

Test Coverage:
- 79 tests covering parser, generator, and integration scenarios
- Test fixtures with realistic lexicon examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant