fix: render Godoc correctly for renamed + union types#2451
Conversation
Greptile SummaryThis PR fixes missing
Confidence Score: 5/5Safe to merge — the only changes are two one-line additions that populate a Godoc string field, and all regenerated fixture files reflect exactly those additions with no unrelated drift. The fix is narrowly scoped to Godoc comment generation: two previously-empty JsonName fields are now populated, and every affected fixture file regenerates correctly. No Go type shapes, struct tags, function signatures, or runtime behavior are altered. No files require special attention.
|
| Filename | Overview |
|---|---|
| pkg/codegen/schema.go | Adds missing JsonName field in two TypeDefinition construction sites: the x-go-type-name extension path and the generateUnion inline-element path, fixing the "defines model for ." Godoc bug. |
| examples/extensions/xgotypename/gen.go | Regenerated output; comment for ClientRenamedByExtension now correctly reads "defines model for ClientWithExtension." instead of "defines model for ." |
| internal/test/aggregates/anyof/anyof.gen.go | Regenerated; union-element type comments now include the correct parent.index path (e.g. "ParamAnyOf.0"). |
| internal/test/aggregates/hoisting/hoisting_schemas.gen.go | Regenerated; hoisted anonymous inner type comment now reads "defines model for OuterTypeWithAnonymousInner.inner." |
| internal/test/aggregates/oneof/components.gen.go | Regenerated; all oneOf element type comments updated with correct parent.index paths. |
| internal/test/extensions/x_go_type/x_go_type.gen.go | Regenerated; MyTestRequest comment now correctly reads "defines model for Test." for the x-go-type-name renamed type. |
| internal/test/naming/conflicts/conflicts.gen.go | Regenerated; CustomQux and several union alias comments now have correct model paths. |
| internal/test/schemas/recursive/recursive.gen.go | Regenerated; all recursive union-element aliases (FilterPredicate1, FilterRangeValue0, etc.) now have correct model path comments. |
| internal/test/options/name_normalizer/to_camel_case/name_normalizer.gen.go | Regenerated; OneOf2things0 and OneOf2things1 union-element comments now include correct parent.index paths. |
| internal/test/options/name_normalizer/to_camel_case_with_additional_initialisms/name_normalizer.gen.go | Regenerated; same union-element Godoc fix as the other name_normalizer variants. |
| internal/test/options/name_normalizer/to_camel_case_with_digits/name_normalizer.gen.go | Regenerated; same union-element Godoc fix as the other name_normalizer variants. |
| internal/test/options/name_normalizer/to_camel_case_with_initialisms/name_normalizer.gen.go | Regenerated; same union-element Godoc fix as the other name_normalizer variants. |
| internal/test/options/name_normalizer/unset/name_normalizer.gen.go | Regenerated; same union-element Godoc fix as the other name_normalizer variants. |
Reviews (1): Last reviewed commit: "fix: render Godoc correctly for union ty..." | Re-trigger Greptile
As otherwise we see `defines model for .`, which isn't correct. Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@rootly.com>
As otherwise we see `defines model for .`, which isn't correct. This isn't the best rendered output but improves our output for now. Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@rootly.com>
|
IMO, we should review this Godoc and improve it - I'm not quite sure if this is as effective/useful as it could be |
|
I agree. It's not very useful. It's very, very old code. It would be nice if it referred to the exact place in the spec that it came from, for example. |
As otherwise we see
defines model for ., which isn't correct.