diff --git a/CHANGELOG.md b/CHANGELOG.md index 7913ee367..5d9c3f808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Version 24 +### v24.7.2 + +- Fixed the negative response MIME type for ~~`arrayResultHandler`~~ (deprecated entity): + - Should have been `text/plain`. + ### v24.7.1 - Compatibility fix for `zod@^3.25.68` and `^4.0.0`: diff --git a/example/example.documentation.yaml b/example/example.documentation.yaml index 10b724341..05697e498 100644 --- a/example/example.documentation.yaml +++ b/example/example.documentation.yaml @@ -441,7 +441,7 @@ paths: "400": description: GET /v1/user/list Negative response content: - application/json: + text/plain: schema: type: string examples: @@ -457,7 +457,7 @@ paths: "400": description: HEAD /v1/user/list Negative response content: - application/json: + text/plain: schema: type: string examples: diff --git a/express-zod-api/src/result-handler.ts b/express-zod-api/src/result-handler.ts index 91925f3d1..4c7038f76 100644 --- a/express-zod-api/src/result-handler.ts +++ b/express-zod-api/src/result-handler.ts @@ -169,7 +169,10 @@ export const arrayResultHandler = new ResultHandler({ } return responseSchema; }, - negative: z.string().example("Sample error message"), + negative: { + schema: z.string().example("Sample error message"), + mimeType: "text/plain", + }, handler: ({ response, output, error, logger, request, input }) => { if (error) { const httpError = ensureHttpError(error);