Skip to content

Conversation

@mashabek
Copy link
Collaborator

@mashabek mashabek commented Nov 2, 2025

@mashabek mashabek self-assigned this Dec 1, 2025
@mashabek mashabek requested a review from pavelsvagr December 2, 2025 08:26
if (pathSpec[method]?.operationId) {
const operationResponses = pathSpec[method].responses ?? {}
const successStatus =
Object.keys(operationResponses).find(status =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: What about redirects (3xx)?

if (operationId && !res.headersSent) {
const metadata = operationPaths[operationId]
if (metadata?.successStatus) {
res.status(metadata.successStatus)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This will overwrite the status user set right?

Imagine having two possible success statuses for operation (200 and 2xx or 200 and 3xx) for example based on Accept header of the client request. If the dev sets the status before the async handler is called, this will overwrite it to 200.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I moved the status code assignment before we execute the operation handler, so anything set by user will overwrite it.

@mashabek mashabek requested a review from pavelsvagr January 2, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants