-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect validation error "Example validation errored: schema with key or id ... already exists" #1245
Comments
Hi @ehuelsmann Thank you for reaching out. We were able to replicate this issue and it appears to be a bug. Please note that we will notify you as soon as the issue is resolved. |
I've managed to simplify the case to the following sample: openapi: 3.0.3
paths:
/products/pricegroups/{id}:
get:
responses:
'200':
content:
application/json:
schema:
type: object
properties:
id:
$ref: '#/components/schemas/pricegroup-id'
examples:
validPricegroup:
value:
id: 1
/products/warehouses/{id}:
get:
responses:
'200':
content:
application/json:
schema:
type: object
properties:
id:
$ref: '#/components/schemas/warehouse-id'
examples:
validWarehouse:
value:
id: 1
components:
schemas:
commonId:
type: integer
pricegroup-id:
$ref: '#/components/schemas/commonId'
warehouse-id:
$ref: '#/components/schemas/commonId'
The issue goes away once |
Thank you! Hope that helps to find a solution! |
Hi @ehuelsmann, the fix is already available in Redocly CLI 1.7. Could you confirm the issue has been resolved? |
@tatomyr, just verified with Redocly CLI 1.8: the problem is indeed gone! Thank you so much! |
In the attached YAML schema API.yaml.gz, the following error is consistently reported:
Example validation errored: schema with key or id "/tmp/tmp.odmvjRGLjU/API.yaml#/components/schemas/commonId" already exists.
1406 | application/json:
1407 | schema:
1408 | $ref: '#/components/schemas/Warehouse'
1409 | examples:
1410 | validWarehouse:
referenced from API.yaml:1407:15 at #/paths/~1products~1warehouses~1{id}/get/responses/200/content/application~1json
Warning was generated by the no-invalid-media-type-examples rule.
API.yaml: validated in 242ms
However, the schema component id "commonId" appears exactly once in the specification. There is also no overlap between the "allOf" elements in the type being validated.
To Reproduce
Steps to reproduce the behavior:
Will show the error above.
Expected behavior
I'm expecting the file to validate without errors. (There are no problems in the examples of this file as far as I can verify.)
Logs
None.
OpenAPI definition
Spec 3.0.3.
Redocly Version(s)
$ npx @redocly/cli --version
1.0.0-beta.125
Node.js
Version(s)$ node --version
v18.16.0
Additional context
None that I know of.
The text was updated successfully, but these errors were encountered: