-
Notifications
You must be signed in to change notification settings - Fork 384
Open
Description
Context
validateOutput() does not take into account the content-type header when validating the response body.
openapi: 3.0.0
info:
description: service description
version: '0.1'
title: service title
tags:
- name: tag1
description: tag1 description
paths:
"/test":
get:
tags:
- tag1
summary: ''
description: ''
operationId: testCreateOne
responses:
'200':
description: ''
content:
application/json: # will incorrectly validate against this schema even if the matched media type is application/custom+json
schema:
properties: {}
application/custom+json:
schema:
required: ['required_property']
properties:
required_property:
type: booleanCurrent Behavior
When a response for a given status code define schemas for multiple content types, it incorrectly attempts to validate the response body against the first found schema rather than for the media type which matches the content type from the response.
Expected Behavior
When a response for a given status code define schemas for multiple content types, it should validate the response body for the matching endpoint, status code and media type.
See expected behaviour at #2714.
Possible Workaround/Solution
Steps to Reproduce
See test at #2714. Please feel free to fix the bug, unsure if I will get to it.
Environment
Metadata
Metadata
Assignees
Labels
No labels