Add graph JSON references and prefixes - #48
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 527e2ab9b2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR extends the lexicon “graph JSON” contract with reference metadata and ordered JSON dictionaries, and adds configurable generated type prefixes across Swift, Kotlin, and TypeScript generators (including CLI wiring and updated tests).
Changes:
- Add
referencestoLexicon.Graph.JSON/Lexicon.Graph.Node.Class.JSON, plusOrderedJSONDictionaryfor stable key ordering in generated JSON. - Introduce
StandAloneTypePrefixesand thread customizable prefixes through SwiftLexicon / SwiftStandAlone / KotlinStandAlone / TypeScriptStandAlone generators. - Update
lexicon-generateCLI options and expand generator test coverage for custom prefixes and new JSON behaviors.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Tests/LexiconGeneratorsTests/StandAloneGeneratorTests.swift | Adds tests validating custom class/protocol prefixes across Swift/Kotlin/TypeScript generators. |
| Tests/LexiconGeneratorsTests/SourceIdentifierTests.swift | Updates prefix API usage and adds coverage for separating base symbols (L/I) from generated prefixes. |
| Tests/LexiconGeneratorsTests/JSONClassesTests.swift | Switches from raw JSON string equality to decoding assertions; validates references and ordered dictionary output. |
| Sources/LexiconGenerators/SwiftTypeDeclarations.swift | Threads StandAloneTypePrefixes through Swift type declaration generation. |
| Sources/LexiconGenerators/SwiftProperties.swift | Threads StandAloneTypePrefixes through Swift property generation. |
| Sources/LexiconGenerators/SwiftLexiconGenerator.swift | Adds generateSource(..., prefixes:) overload and uses prefixes for root/type naming. |
| Sources/LexiconGenerators/StandAlone/TypeScriptStandAloneGenerator.swift | Adds prefix-configurable generation and updates internal helpers to use StandAloneTypePrefixes. |
| Sources/LexiconGenerators/StandAlone/SwiftStandAloneGenerator.swift | Adds generateSource(..., prefixes:) overload and uses prefixes for root/type naming. |
| Sources/LexiconGenerators/StandAlone/KotlinStandAloneGenerator.swift | Adds generateSource(..., prefixes:) overload and uses prefixes for root/type naming. |
| Sources/LexiconGenerators/SourceIdentifier.swift | Introduces StandAloneTypePrefixes and updates naming logic to keep base symbols distinct. |
| Sources/Lexicon/Lexicon.Graph.JSON.swift | Adds ordered dictionary type, references computation, and updates JSON model to include references and ordered maps. |
| Sources/lexicon-generate/CodeGenerator.swift | Adds CLI options for class/protocol prefixes and routes them into supported generators. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
527e2ab to
eceb790
Compare
Adds graph JSON reference metadata, ordered JSON dictionaries for generated contracts, and configurable generated type prefixes for Swift, Kotlin, and TypeScript output.
Validation:
swift test --filter JSONClasses™ --filter SourceIdentifierTests --filter SwiftLexiconGeneratorTests --filter SwiftStandAloneGeneratorTests --filter KotlinStandAloneGeneratorTests --filter TypeScriptStandAloneGeneratorTests --filter LexiconGeneratorsTests