-
Notifications
You must be signed in to change notification settings - Fork 40
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
Audit request fails when using yaml anchors #100
Comments
Thanks for the detailed example, will take a look! |
This is fixed in the next release (should be published in a couple of days). I would personally advice against using YAML anchors as it adds additional level of complexity to OpenAPI. Using http://json-schema.org/understanding-json-schema/reference/combining.html (and taking https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#schema-object into consideration) is better, as it would not hide the source of schema definitions from the tools which validate JSON schemas and are not aware of YAML anchors. |
@ak1394 thanks for the fix!
Yeah I know, so I'm using the anchors only in really obvious case where they don't impact schema readability and validation, like the one I posted. Unfortunately if I understand correctly the JSON-schema combinators don't work in this case, because (1) they're poorly supported in generators (or not at all in my case (typescript)), (2) they work a bit different -- even the docs say that |
Issue
In my
components/schemas
I'm sometimes using a YAML&anchor
and its merge operator (<<: *anchor
), notably in object property definitions, to avoid repetitions when one object type extends another. If such anchors are used, requesting the security audit fails:1.If the anchor is used in a
$ref
erenced separate file, as pasted below, the error says:2. If I merge the files below instead of
$ref
erencing the other file, the error says:The SwaggerUI preview rendering in the extension works fine, so does using the
openapi-generator
on such a spec.If I delete the anchor, and just copy the first object's properties into the second object's properties, the extension works correctly.
Minimal example
test-api.yml
paths-foo.yml
The text was updated successfully, but these errors were encountered: