feat(client): Add ContentType() to ClientWithResponses responses#2173
Conversation
d623014 to
e843856
Compare
e843856 to
1905682
Compare
1905682 to
b72509c
Compare
Flip the ContentType() method on ClientWithResponses response types from opt-in to default-on. The output option is renamed from `client-response-content-type-function` (enable) to `skip-client-response-content-type` (disable). - pkg/codegen/configuration.go: field renamed to SkipClientResponseContentType - configuration-schema.json: key renamed, description inverted - pkg/codegen/templates/client-with-responses.tmpl: condition inverted - internal/test/issues/issue-240-2149: removed; issue240 restored from upstream/main (original issue 240 bytes-function test is still present and ContentType() is now exercised by every generated client) Regenerated all affected .gen.go files. The resulting diff across generated code is large but purely additive: each response type gains a new ContentType() method; no existing declarations are modified or removed, so downstream users cannot be broken by this change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryAdds a
Confidence Score: 4/5Safe to merge with minor concerns; the implementation is correct but the opt-out default is inconsistent with All findings are P2 — design inconsistency between opt-out
|
| Filename | Overview |
|---|---|
| pkg/codegen/templates/client-with-responses.tmpl | Adds ContentType() method to all response types, generated by default (opt-out), inconsistent with opt-in Bytes() method; no dedicated test exists for the new method or its skip option |
| pkg/codegen/configuration.go | Adds SkipClientResponseContentType bool to OutputOptions with correct YAML tag; field name, YAML tag, and JSON schema are all consistent |
| configuration-schema.json | Adds skip-client-response-content-type boolean field with accurate description; schema entry is correct and consistent with the Go struct |
Reviews (1): Last reviewed commit: "Make ContentType() default on" | Re-trigger Greptile
Fix for issue #2149.
Similar approach as taken in #1780.