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.

lint: non-existing object properties listed as required are ignored

See original GitHub issue

Describe the bug The openapi-cli ignores non-existing object properties which are listed as required. Anything can be listed under the required: tag and the lint will not return any errors.

To Reproduce Steps to reproduce the behavior:

  1. Use the example petstore.yaml (the behaviour is the same with 2.0, 3.0 and 3.1)
  2. Add a non-existing or rename an existing required property:
diff --git a/petstore.yaml b/petstore.yaml
index 5f41fe0..531cbbf 100644
--- a/petstore.yaml
+++ b/petstore.yaml
@@ -78,6 +78,7 @@ definitions:
     required:
       - id
       - name
+      - non-existing-property
     properties:
       id:
         type: integer
  1. Run openapi lint petstore.yaml --format stylish
  2. The output is:
No configurations were defined in extends -- using built-in recommended configuration by default.

validating petstore.yaml...
petstore.yaml:
  2:1   warning  info-description        Info object should contain `description` field.
  5:3   warning  info-license-url        License object should contain `url` field.
  29:7  warning  operation-4xx-response  Operation must have at least one `4xx` response.
  47:7  warning  operation-4xx-response  Operation must have at least one `4xx` response.
  66:7  warning  operation-4xx-response  Operation must have at least one `4xx` response.

petstore.yaml: validated in 26ms

Woohoo! Your OpenAPI definition is valid. 🎉
You have 5 warnings.
  1. The exit code:
$ echo $?
0

Expected behavior There should be an error saying the required property is not defined, for example:

"non-existing-property" is present in required but not defined as property in definition "Pet"

openapi-cli Version(s)

$ openapi --version
1.0.0-beta.73

Node.js Version(s)

$ node --version
v17.2.0

Additional context

  • The behaviour is the same with all OpenAPI versions.
  • There is no .redocly.yaml present, the default out-of-the-box openapi-cli is used.
  • The same can be observed using the latest NPM and Docker versions.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
davidkuridzacommented, Nov 12, 2022

@tatomyr no problem, good things come to those who wait 😃

1reaction
adamaltmancommented, Sep 5, 2022

@davidkuridza finally in progress on this one. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignore Typescript Errors "property does not exist on value of ...
I used this in "ensure property not found on NodeRequire". so I declared my require variable on NodeRequired and (require as any).ensure for...
Read more >
List of Java inspections | IntelliJ IDEA Documentation - JetBrains
Inspection name. Default state. Default severity. Arquillian test class should be properly prepared. Enabled. Error icon Error.
Read more >
stylelint | Yarn - Package Manager
Stylelint. npm version Build Status npm downloads. A mighty, modern linter that helps you avoid errors and enforce conventions in your styles.
Read more >
Standard Checkers - Pylint 2.16.0-dev documentation
Always return a 0 (non-error) status code, even if lint errors are found. ... List of method names used to declare (i.e. assign)...
Read more >
Objects - The Modern JavaScript Tutorial
An object can be created with figure brackets {…} with an optional list of properties. A property is a “key: value” pair, where...
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