`allOf` in oas3 is handled incorrectly under Windows making examples not fail the mediatype validation
See original GitHub issueDescribe the bug
allOf
in oas3 is handled incorrectly making examples fail the validation
To Reproduce Steps to reproduce the behavior:
- Given this
.redocly.yaml
file
lint:
extends:
- recommended
rules:
info-contact: off
- And this OpenAPI file: (
openapi.yaml
)
openapi: "3.0.3"
info:
title: bugtest
version: "1.0"
description: Demo
license:
name: DEMO
url: https://demo.com
servers:
- url: http://demo.com/api
components:
examples:
DemoResponse:
description: Demo
value:
name: "demo"
demo: "Demo"
schemas:
Demo:
type: object
required:
- name
- demo
properties:
name:
type: string
maxLength: 100
demo:
type: string
DemoAllOf:
allOf:
- type: object
required:
- name
properties:
name:
type: string
maxLength: 100
- type: object
required:
- demo
properties:
demo:
type: string
paths:
/demo:
summary: "Demo with schema NO allOf and NO baseRef"
get:
summary: "Get demo no refs"
operationId: getDemoNoRefs
description: "Returns Demo No Refs"
responses:
200:
description: Demo No Refs
content:
application/json:
schema:
$ref: "#/components/schemas/Demo"
examples:
Demo1:
$ref: "#/components/examples/DemoResponse"
/demoAllOf:
summary: " Demo with schema allOf and NO baseRef"
get:
summary: "Get demo no refs"
operationId: getDemoAllOf
description: "Returns Demo refs with baseRef"
responses:
200:
description: Demo refs with baseRef
content:
application/json:
schema:
$ref: "#/components/schemas/DemoAllOf"
examples:
Demo:
$ref: "#/components/examples/DemoResponse"
- Run this command:
npx @redocly/openapi-cli lint openapi.yaml
- See error
On Windows 10: NONE
On github
ubuntu-latest
: warnings from rule:no-invalid-media-type-examples
becauseallOf
is not correctly handled
Expected behavior
No warnings should be generated on ubuntu-latest
or WSL 2 with Ubuntu 20.04 (other linux versions not tested)
Logs If applicable, add logs to help explain your problem.
OpenAPI definition
If applicable, add an OpenAPI definition and .redocly.yaml
configuration file that helps reproduce the problem.
At a minimum, please state the specification version(s) you’re using (e.g. 2.0, 3.0, 3.1).
openapi-cli
Version(s)
What version of openapi-cli
are you using?
latest (with npx)
Node.js
Version(s)
What version of node.js
are you using?
Latest LTS Version: 14.15.1 (includes npm 6.14.8)
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:8 (4 by maintainers)
@CommCody in this rule, we decided to disallow additional properties by default (like if each schema had
additionalProperties: false
). This is a very common mistake people make (do not setadditionalProperties: false
).You can configure this behaviour in the .redocly.yaml:
See: https://redoc.ly/docs/cli/built-in-rules/#no-invalid-media-type-examples
It is strange it does not show any warnings in Windows. We have to check this.
Confirm, reproduces for me.