fix: handle untyped strict JSON responses - #2514
Conversation
Greptile SummaryThe PR replaces the earlier external-reference work with a focused strict JSON response fix.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains, and the previously reported external-reference issue is avoided because the focused replacement no longer changes externalref.go.
|
| Filename | Overview |
|---|---|
| pkg/codegen/operations.go | Adds strict-response receiver classification and reusable-response header ownership without reintroducing the previously reported external-reference qualification path. |
| pkg/codegen/templates/strict/strict-interface.tmpl | Uses wrapper bodies only when the classified JSON type cannot serve as a method receiver. |
| pkg/codegen/templates/strict/strict-fiber-interface.tmpl | Mirrors the strict response representation and serialization behavior for Fiber. |
| pkg/codegen/templates/strict/strict-iris-interface.tmpl | Mirrors the strict response representation and serialization behavior for Iris. |
| pkg/codegen/templates/strict/strict-responses.tmpl | Keeps reusable strict response envelopes aligned with operation-specific response types. |
| pkg/codegen/operations_test.go | Adds focused generation coverage for receiver-compatible and wrapper-requiring response body types. |
| internal/test/references/multipackage/response_cast/issue_test.go | Adds compile-time cross-package conversion coverage across the supported strict template families. |
Reviews (2): Last reviewed commit: "test: cover strict JSON response receive..." | Re-trigger Greptile
9fc54da to
4243417
Compare
|
This also fixes #2525, which @mromaszewicz filed during review of #2522 (same bug as #1328). I was about to start on it and found this PR instead, so I took it for a spin rather than duplicate the work. I merged the branch onto current main and generated strict-server code for every shape from #2525: Two non-blocking suggestions:
Neither should hold this up. The wrapper shape matches what #2525 proposes, and wrapping only receiver-incompatible bodies keeps the direct API for everything that compiles today. |
Summary
Scope
Testing
AI assistance
This change was developed with AI assistance.
Fixes #1328