When schema in content for response is empty, generated strict server codes are broken. ``` $ $ cat issue.yaml openapi: "3.0.1" paths: /test: get: operationId: test responses: 200: description: good content: application/json: schema: $ go run cmd/oapi-codegen/oapi-codegen.go -generate types,server,strict-server -package issue -o issue.go issue.yaml && go test issue.go # command-line-arguments ./issue.go:78:7: invalid receiver type Test200JSONResponse (pointer or interface type) FAIL $ ```
Activity
renom commentedon Jan 28, 2025
Is there a workaround?
jpeach commentedon Jun 3, 2025
FWIW I worked around this with
Then EmptyResponse looks like:
jpeach commentedon Jun 5, 2025
Serves me right for posting before testing; the JSON marshaller returns an error if you return empty bytes; so this isn't actually a workaround :(
jpeach commentedon Jun 5, 2025
This seems to generate the right code:
test: describe what the response_cast fixture now covers
fix: handle untyped strict response bodies (#2514)