fix(clientgen): avoid shared JSON mapping collisions - #247
Conversation
🔍 CI Pipeline Status✅ Lint: success 📊 Coverage Report: Available in checks above |
SebastienMelki
left a comment
There was a problem hiding this comment.
Review
Clean ownership fix — go-http is now the sole emitter of package-level JSON mapping files, eliminating duplicate symbol errors when both Go plugins target the same package. The client dispatches through sebufUnmarshaler/json.Marshaler interfaces at runtime, so it picks up custom marshalers when present and falls back to protojson otherwise.
What I checked
- Deleted files (10 source + 15 golden) are genuinely duplicates of httpgen equivalents — no client-specific logic lost.
enum_validation.gocorrectly preserves the fail-fast annotation conflict check without emitting code.generator.go:52-59early return for service-less files is well-commented and correct.marshalRequest/unmarshalResponsedispatch logic unchanged — interface-based forwarding togo-http-owned methods works as before.- Golden test expectations updated consistently — no references to deleted golden files remain.
- Consistency tests in httpgen properly removed the
TestGoGeneratorsProduceIdentical*tests that compared go-http vs go-client output (now moot), while keeping TS + OpenAPI cross-generator checks intact. - Combined generation test (
TestCombinedGoHTTPAndGoClientGenerationDoesNotDuplicateJSONMappingFiles) is a solid regression guard.
Minor suggestions (non-blocking)
-
Combined test coverage: The test only exercises
int64_deep_nested_encoding.proto. Adding a second fixture (e.g.flatten.protoorenum_encoding.proto) would catch regressions across more annotation families. -
Client-only usage discoverability: If someone uses
go-clientwithoutgo-http, mapping annotations silently have no effect. The doc update inclient-generation.mdmentions this but it's easy to miss in a long sentence. A short callout box or generation-time warning could save users debugging time.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #247 +/- ##
==========================================
+ Coverage 28.88% 34.56% +5.68%
==========================================
Files 75 67 -8
Lines 13157 10994 -2163
==========================================
Hits 3800 3800
+ Misses 9160 6997 -2163
Partials 197 197
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Examples review follow-up pushed in be53144. What changed:
Verification:
|
|
LGTM. Clean ownership separation — all 9 JSON mapping generators removed from clientgen with no stale references, enum validation correctly retained, combined generation test verifies no duplicate files, and consistency tests properly updated. Docs reflect the new boundary. |
Summary
Fixes #246
Verification