redocly-cli
redocly-cli copied to clipboard
"Parameter must contain 'schema' or 'content'" is not validated against openAPI 3.0.0 spec
Describe the bug No validation rule applies that a parameter must contain a 'schema' or a 'content' field. Defined in: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md
A parameter MUST contain either a schema property, or a content property, but not both.
To Reproduce
responses:
'200':
description: My description
default:
description: >-
My description
headers:
Content-Type:
description: ThisHeaderNeedsASchemaOrElseItsNotValid
content:
application/json:
schema:
format: binary
title: File download
type: string
Expected behavior An error should be shown, that the 'A parameter MUST contain either a schema property, or a content property'
Logs
OpenAPI definition 3.0.0/3.1.0
Redocly Version 1.0.0-beta.105
Node.js
Version(s)
v16.12.0
Additional context https://apitools.dev/swagger-parser/online/ and https://editor.swagger.io/ deliver the error: Swagger schema validation failed. #/paths/.../responses/default/headers/Content-Type must have required property 'schema'
Hi @azimbelm,
Thanks for reporting this issue.
Looks like the Header
type is missing this section from the Parameter
type:
https://github.com/Redocly/redocly-cli/blob/master/packages/core/src/types/oas3.ts#L139
Another way might be to avoid duplicating the properties and use omitObjectProps.
@AntonKozachuk what do you mean about the Header
type missing? Header
is not part of Parameters -- they are related to the response, right? https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#headerObject
Ahh, you mean that link is missing that appears in the definition of Parameter
type. You are right!