You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Meaning, if a previous path item (ops) was an external reference, parentIsExternal will be also set to true for the next path item even if the next path item isn't an external reference.
The effect of the issue is especially seen when customizing refNameResolver but I was also able to create an example with the default refNameResolver:
/foo was processed after /bar which set parentIsExternal to true. This caused everything under /foo to be processed as if it has an external reference parent: $ref: "#/components/requestBodies/test/content/application~1json/schema" was "internalized" and replaced with "$ref":"#/components/schemas/schema".
The text was updated successfully, but these errors were encountered:
Hi,
Looks like there is a slight issue in the ref internalization code.
kin-openapi/openapi3/internalize_refs.go
Line 339 in 8c08c70
It seems that
parentIsExternal
is modified inside the for loop and the modification persists causing it to effect other iterations of the loop.if isExternalRef(ops.Ref, parentIsExternal) { parentIsExternal = true }
Meaning, if a previous path item (
ops
) was an external reference,parentIsExternal
will be also set totrue
for the next path item even if the next path item isn't an external reference.The effect of the issue is especially seen when customizing
refNameResolver
but I was also able to create an example with the defaultrefNameResolver
:For example, for a root document:
And a document named 'path.yaml' under the same folder:
The result is:
/foo
was processed after/bar
which setparentIsExternal
totrue
. This caused everything under/foo
to be processed as if it has an external reference parent:$ref: "#/components/requestBodies/test/content/application~1json/schema"
was "internalized" and replaced with"$ref":"#/components/schemas/schema"
.The text was updated successfully, but these errors were encountered: