If path returns both 200 and 204 responses, the generated code throws error on 204 if schema is expected on 200.
Repro steps
swagger.json:
{
"openapi": "3.0.1",
"info": {
"title": "API 1.0",
"description": "REST API",
"version": "1.0"
},
"paths": {
"/product": {
"post": {
"summary": "Create product",
"operationId": "productPost",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProductResponse"
}
}
}
},
"204": {
"description": "No Content"
}
}
}
}
},
"components": {
"schemas": {
"ProductResponse": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"additionalProperties": false
}
}
}
}
Run this script to generate API:
npx react-query-swagger /tanstack /input:swagger.json /output:client.ts /template:Axios /use-recommended-configuration /minimal
Output:
Proposed behaviour
Response 204 should not throw exception.

If path returns both 200 and 204 responses, the generated code throws error on 204 if schema is expected on 200.
Repro steps
swagger.json:
Run this script to generate API:
npx react-query-swagger /tanstack /input:swagger.json /output:client.ts /template:Axios /use-recommended-configuration /minimalOutput:
Proposed behaviour
Response 204 should not throw exception.