Problem
OpenAPI 3 request bodies that are not application/json lose their media type during parsing, and runtime request execution still sends file or set bodies as JSON. That makes generated commands incorrect for text/plain, application/xml, and other non-JSON request bodies.
Evidence
internal/codegen/backends/openapi3/backend.go sets RequestBody.MediaType only for application/json.
- In the non-JSON branch, it sorts content types and keeps the schema but does not store the chosen media type.
- The existing
request-body-non-json golden fixture shows a text/plain / application/xml OpenAPI input producing a RequestBody with no MediaType.
pkg/runtime/client.go sets Content-Type: application/json for raw []byte bodies, which is what --file and --set currently produce.
Expected behavior
Codegen should preserve the selected request body media type in CommandSpec.RequestBody.MediaType, and runtime should send that as Content-Type. If a media type is unsupported by the current body builders, command execution should fail clearly instead of silently sending JSON.
Verification
make test currently passes; the existing golden fixture documents the current lossy behavior rather than rejecting it.
Problem
OpenAPI 3 request bodies that are not
application/jsonlose their media type during parsing, and runtime request execution still sends file or set bodies as JSON. That makes generated commands incorrect fortext/plain,application/xml, and other non-JSON request bodies.Evidence
internal/codegen/backends/openapi3/backend.gosetsRequestBody.MediaTypeonly forapplication/json.request-body-non-jsongolden fixture shows atext/plain/application/xmlOpenAPI input producing aRequestBodywith noMediaType.pkg/runtime/client.gosetsContent-Type: application/jsonfor raw[]bytebodies, which is what--fileand--setcurrently produce.Expected behavior
Codegen should preserve the selected request body media type in
CommandSpec.RequestBody.MediaType, and runtime should send that asContent-Type. If a media type is unsupported by the current body builders, command execution should fail clearly instead of silently sending JSON.Verification
make testcurrently passes; the existing golden fixture documents the current lossy behavior rather than rejecting it.