fix: schema property:example should be validated (#375)

* fix: schema property:example should be validated
* chore: schema-example separate rule
* test: example-schema: string, number, int
* chore: example object in schema test + minor rule fix
* chore: support v3.1.0
* chore: rewrite schema-example-type rule using ajv
* update tests for 3.1
* chore: no-invalid-parameter-examples rule
* fix: reporting
* chore: added disallowAdditionalProperties
* docs: rules no-invalid parameter & schema examples
This commit is contained in:
Andriy Leliv
2021-12-06 11:50:58 +02:00
committed by GitHub
parent 6367b5f975
commit 9ebd1a8b01
29 changed files with 822 additions and 42 deletions

View File

@@ -0,0 +1,28 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`E2E lint no-invalid-schema-examples-array-error 1`] = `
validating /openapi.yaml...
[1] openapi.yaml:34:21 at #/paths/~1my_post/post/requestBody/content/application~1json/schema/properties/my_list/example
Example value must conform to the schema: type must be array.
32 | type: string
33 | example:
34 | test
| ^^^^
35 | responses:
36 | '200':
referenced from openapi.yaml:29:19
Error was generated by the no-invalid-schema-examples rule.
/openapi.yaml: validated in <test>ms
❌ Validation failed with 1 error.
run \`openapi lint --generate-ignore-file\` to add all problems to the ignore file.
`;