feat: Add Go language exporter using typed API struct literals (WIP)#104
Draft
MattDevy wants to merge 9 commits into
Draft
feat: Add Go language exporter using typed API struct literals (WIP)#104MattDevy wants to merge 9 commits into
MattDevy wants to merge 9 commits into
Conversation
Implements a TypeScript-based Go exporter that generates idiomatic go-elasticsearch typed API code from Dev Console syntax. Uses the bundled Elasticsearch spec metadata for type-aware struct literal generation, including container variants, enums, dictionary types, and shortcut properties.
Add a Go exporter that generates typed API struct literals for go-elasticsearch/v9. Uses the expanded (no-generics) schema matching what elastic-client-generator-go produces, with a type rename map for naming collisions. The exporter is structured as a modular subfolder (src/exporters/go/) with focused, testable components: TypeResolver for schema lookups, RenderContext for threading state through recursive rendering, GoValueRenderer for value-to-Go-code conversion, and ImportTracker for managing Go import statements.
Cover 19 additional test cases from the implementation plan: subclient calls, enum query params, nested structures, aggregations, ingest pipelines, KNN search, function score queries, runtime mappings, and deeply nested queries.
- Resolve property aliases (JSON "aggs" → Go field "Aggregations") - Remove incorrect id/ip special-casing in toPascalCase to match generator - Resolve union type aliases to "any" when the Go type is a type alias - Detect user_defined_value request bodies and render as untyped maps - Track pointer vs value context in slices and map elements - Ensure boolean query params render as bool, not string - Route unknown container variant keys to AdditionalProperty map fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP
TODO: