lint: non-existing object properties listed as required are ignored
See original GitHub issueDescribe 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:
- Use the example petstore.yaml (the behaviour is the same with 2.0, 3.0 and 3.1)
- 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
- Run
openapi lint petstore.yaml --format stylish
- 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.
- 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-boxopenapi-cli
is used. - The same can be observed using the latest NPM and Docker versions.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (6 by maintainers)
Top 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 >
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
@tatomyr no problem, good things come to those who wait 😃
@davidkuridza finally in progress on this one. 👍