mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-10 04:21:20 +00:00
* 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
140 lines
3.1 KiB
JavaScript
140 lines
3.1 KiB
JavaScript
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`E2E lint no-invalid-schema-examples-nested-error 1`] = `
|
|
|
|
validating /openapi.yaml...
|
|
[1] openapi.yaml:20:23 at #/paths/~1pet/parameters/0/schema/example/property
|
|
|
|
Example value must conform to the schema: \`property\` property type must be string.
|
|
|
|
18 | schema:
|
|
19 | example:
|
|
20 | property: 42
|
|
| ^^
|
|
21 | type: object
|
|
22 | properties:
|
|
|
|
referenced from openapi.yaml:19:11
|
|
|
|
Error was generated by the no-invalid-schema-examples rule.
|
|
|
|
|
|
[2] openapi.yaml:53:20 at #/components/schemas/Test/properties/my_list/example
|
|
|
|
Example value must conform to the schema: type must be string.
|
|
|
|
51 | my_list:
|
|
52 | type: string
|
|
53 | example: 50
|
|
| ^^
|
|
54 | nested:
|
|
55 | allOf:
|
|
|
|
referenced from openapi.yaml:52:11
|
|
|
|
Error was generated by the no-invalid-schema-examples rule.
|
|
|
|
|
|
[3] openapi.yaml:72:20 at #/components/schemas/Dog/properties/my_list/example
|
|
|
|
Example value must conform to the schema: type must be string.
|
|
|
|
70 | my_list:
|
|
71 | type: string
|
|
72 | example: 32
|
|
| ^^
|
|
73 | Category:
|
|
74 | type: object
|
|
|
|
referenced from openapi.yaml:71:11
|
|
|
|
Error was generated by the no-invalid-schema-examples rule.
|
|
|
|
|
|
[4] openapi.yaml:68:16 at #/components/schemas/Dog/example
|
|
|
|
Example value must conform to the schema: type must be object.
|
|
|
|
66 | Dog:
|
|
67 | type: object
|
|
68 | example: test dog example
|
|
| ^^^^^^^^^^^^^^^^
|
|
69 | properties:
|
|
70 | my_list:
|
|
|
|
referenced from openapi.yaml:67:7
|
|
|
|
Error was generated by the no-invalid-schema-examples rule.
|
|
|
|
|
|
[5] openapi.yaml:62:28 at #/components/schemas/Test/properties/nested/allOf/1/properties/huntingSkill/example
|
|
|
|
Example value must conform to the schema: type must be string.
|
|
|
|
60 | huntingSkill:
|
|
61 | type: string
|
|
62 | example: 100
|
|
| ^^^
|
|
63 | nested_schema:
|
|
64 | oneOf:
|
|
|
|
referenced from openapi.yaml:61:19
|
|
|
|
Error was generated by the no-invalid-schema-examples rule.
|
|
|
|
|
|
[6] openapi.yaml:79:20 at #/components/schemas/Category/properties/id/example
|
|
|
|
Example value must conform to the schema: type must be number.
|
|
|
|
77 | type: number
|
|
78 | description: Category ID
|
|
79 | example: category example
|
|
| ^^^^^^^^^^^^^^^^
|
|
80 |
|
|
|
|
referenced from openapi.yaml:77:11
|
|
|
|
Error was generated by the no-invalid-schema-examples rule.
|
|
|
|
|
|
[7] openapi.yaml:58:24 at #/components/schemas/Test/properties/nested/allOf/1/example
|
|
|
|
Example value must conform to the schema: type must be object.
|
|
|
|
56 | - $ref: '#/components/schemas/Dog'
|
|
57 | - type: object
|
|
58 | example: dog
|
|
| ^^^
|
|
59 | properties:
|
|
60 | huntingSkill:
|
|
|
|
referenced from openapi.yaml:57:15
|
|
|
|
Error was generated by the no-invalid-schema-examples rule.
|
|
|
|
|
|
[8] openapi.yaml:49:16 at #/components/schemas/Test/example
|
|
|
|
Example value must conform to the schema: type must be object.
|
|
|
|
47 | Test:
|
|
48 | type: object
|
|
49 | example: test example
|
|
| ^^^^^^^^^^^^
|
|
50 | properties:
|
|
51 | my_list:
|
|
|
|
referenced from openapi.yaml:48:7
|
|
|
|
Error was generated by the no-invalid-schema-examples rule.
|
|
|
|
|
|
/openapi.yaml: validated in <test>ms
|
|
|
|
❌ Validation failed with 8 errors.
|
|
run \`openapi lint --generate-ignore-file\` to add all problems to the ignore file.
|
|
|
|
|
|
`;
|