question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Required property should not be flagged as invalid when using inside allOf

See original GitHub issue

Issue 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:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
EricWittmanncommented, Nov 6, 2018

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.

0reactions
EricWittmanncommented, Nov 20, 2018

Closing this since I have disabled the offending validation rule.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found