allOf raises invalid media examples (model composition)
See original GitHub issueDescribe the bug
Making use of allOf
raises no-invalid-media-type-examples
Expected behavior
allOf
combines the objects as expected
openapi: 3.1.0
info:
version: '1.0'
title: Test
description: |
Test OAS
license:
name: Copyright
url: 'https://foo.com'
contact:
name: Contact
url: 'https://www.foo.com'
email: bar@foo.com
servers:
- url: 'https://foo.com'
tags:
- name: Test
description: A Test API
paths:
/test:
get:
summary: Retrieve a Test
operationId: getTest
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/TestModel'
example:
address_1: boulevard Montmartre
address_2: 5eme etage
city: Paris
country_state: null
email: 'foo@bar.com'
components:
schemas:
TestModel:
title: TestModel
description: A Test Object
allOf:
- $ref: '#/components/schemas/BaseModel'
- type: object
properties:
address_1:
type: string
address_2:
type: string
city:
type: string
country_state:
type:
- string
- 'null'
BaseModel:
title: BaseModel
type: object
description: A Base test model for testing
properties:
email:
type: string
When running the above, redocly complains about the example and all of the fields (excerpt from the validation)
Example value must conform to the schema: must NOT have additional properties `address_2`.
34 | email: foo@bar.com
35 | address_1: boulevard Montmartre
36 | address_2: 5eme etage
37 | city: Paris
38 | country_state: null
referenced from schemas/orders/test.yaml:29:15
Error was generated by the no-invalid-media-type-examples rule.
When removing the example from responses
the linter stop complaining.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Lint: inaccurate examples warning produced when using ...
The lint rule no-invalid-media-type-examples is inaccurately reported as being violated when using a combination of schema inheritance and ...
Read more >no-invalid-media-type-examples - Redocly
Disallow invalid media type examples by ensuring they comply with the corresponding schema definitions.
Read more >AP English Literature and Composition Practice Exam (2012)
Section I of this exam contains 55 multiple-choice questions. Fill in only the circles for numbers 1 through 55 on your answer sheet....
Read more >33 Problems With Media in One Chart - Visual Capitalist
Modern media is broken. In this infographic, we highlight 33 problems with the social and mass media ecosystem today.
Read more >15 Photography Composition Techniques to Improve Your ...
In this guide we discuss 11 composition techniques in photography to ... There are many elements to consider, and all of them have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@SmoliyY Thanks! I can confirm this is now working as expected!
Hi @petkostas! This issue fixed in 1.0.0.beta-110 version. Please, let us know if it works for you, thx)