fix(ext-openapi): an answer's media type is the handler's, not the body's #21

Merged
Relism merged 1 commits from fix/openapi/answer-media-type into master 2026-09-23 14:42:14 +00:00
Owner

@Consumes says what a route reads, and it was also deciding what the document claimed a route answers — a handler that takes a JSON body is not thereby one that answers JSON.

@Produces now says that, beside @Consumes and just as descriptive: on the handler, or once on a base class. Every response takes its media type from it, JSON when nothing declares one; the error object stays JSON, because that is what Flash answers a failure with whatever the route produces.

@Content loses contentType with it: one handler answers in one format and a status code does not change that. A response with no schema and no return type to infer one from is a response with no body, which is what contentType = NONE was used to say.

Green: full build, tests and coverage gates.

🤖 Generated with Claude Code

`@Consumes` says what a route reads, and it was also deciding what the document claimed a route answers — a handler that takes a JSON body is not thereby one that answers JSON. `@Produces` now says that, beside `@Consumes` and just as descriptive: on the handler, or once on a base class. Every response takes its media type from it, JSON when nothing declares one; the error object stays JSON, because that is what Flash answers a failure with whatever the route produces. `@Content` loses `contentType` with it: one handler answers in one format and a status code does not change that. A response with no schema and no return type to infer one from is a response with no body, which is what `contentType = NONE` was used to say. Green: full build, tests and coverage gates. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Relism added 1 commit 2026-09-23 14:42:07 +00:00
@Consumes says what a route reads. It was also deciding what the document said
a route answers, through a JSON default nothing could override: a handler that
takes a JSON body is not thereby a handler that answers JSON.

@Produces now says that, beside @Consumes and as descriptive as it is — on the
handler, or once on a base class. Every response takes its media type from it,
JSON when nothing declares one, and the error object stays JSON because that is
what Flash answers a failure with whatever the route produces.

Content loses contentType with it. One handler answers in one format and a
status code does not change that, so the media type was in the wrong place; a
response with no schema and no return type to infer one from is a response
with no body, which is what a 204 was using it to say.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Relism merged commit dd0455c6d1 into master 2026-09-23 14:42:14 +00:00
Relism deleted branch fix/openapi/answer-media-type 2026-09-23 14:42:15 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Relism/Flash5#21