Required property should not be flagged as invalid when using inside allOf
See original GitHub issueIssue inspector finds that a property inside required
don’t exists, but it’s false. In particular: Schema lists property "from" as required, but it does not exist. No additional information found.
In fact it exists in another schema merged using allOf
:
components:
schemas:
Username:
minLength: 5
type: string
NewTransaction:
allOf:
-
required:
- from
- to
- description
- value
type: object
-
$ref: '#/components/schemas/UpdateTransaction'
UpdateTransaction:
type: object
properties:
from:
$ref: '#/components/schemas/Username'
to:
$ref: '#/components/schemas/Username'
value:
type: number
description:
minLength: 1
type: string
Transaction:
allOf:
- $ref: '#/components/schemas/UpdateTransaction'
-
required:
- from
- to
- id
- description
- value
- at
type: object
properties:
id:
type: string
at:
format: date-time
type: string
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Invalid schema causes "should have required property '$ref ...
Describe the bug When an OpenAPI v3 Response Object contains a schema which has invalid schemas, an error is thrown saying: should have...
Read more >Nesting oneOf inside allOf not working as expected (python ...
Providing a null value in a property is still providing a property. The error message is confusing, but you'd be failing validation anyway ......
Read more >Invalid schema on Merchant listing report - WordPress.org
The issue is that all sites using schema generated by Yoast is not allowing us to validate any of our ecommerce sites. When...
Read more >Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >17.7.0 API Reference - joi.dev
Note that references can only be used where explicitly supported such as in valid() or invalid() rules. If upwards (parents) references are needed,...
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 FreeTop 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
Top GitHub Comments
Ah ha - well then I think that is the issue: you can require a property without defining it.
So the validation rule I added for this was simply erroneous. I think what I’ll do is disable it (for now) until I have a way of enabling/disabling rules in the Apicurio UI. Once that’s done, we can start doing all sorts of interesting things with additional validation rules like this.
Closing this since I have disabled the offending validation rule.