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
An external reference can be used on a path item with $ref key as specified in openapi 2+ specs : Allows for a referenced definition of this path item. The referenced structure MUST be in the form of a Path Item Object. In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving Relative References.
Adding an external reference should throw no error if it references a valid path item and should be handled by apicurio dereferencer.
Actual Behavior
In source mode an issue is thrown Path Item Reference must refer to a valid Path Item Definition . When preview or export with dereferencement is done an error is thrown.
The referenced path item node can't be fetched because / must be unescaped from ~1 to get correct path item key . (see Apitomy/apitomy-data-models#858).
The second error during dereference is because the Dereferencer class in apicurio-data-models doesn't implement path item case. It tries to add the referenced node into components and then change originel external ref to an internal one. But path items can't be defined in components. The referenced node is supposed to be "merged" according the spec.
Proposed fix
I can write a PR to fix the second issue. I propose to do a simple non recursive merge of the external path item properties into the internal one and ignore external path item properties if they are already defined in internal path item (since spec says In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined).
Expected Behavior
An external reference can be used on a path item with
$refkey as specified in openapi 2+ specs :Allows for a referenced definition of this path item. The referenced structure MUST be in the form of a Path Item Object. In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving Relative References.Adding an external reference should throw no error if it references a valid path item and should be handled by apicurio dereferencer.
Actual Behavior
In source mode an issue is thrown
Path Item Reference must refer to a valid Path Item Definition. When preview or export with dereferencement is done an error is thrown.Steps to Reproduce the Problem
Specifications
Cause
The referenced path item node can't be fetched because
/must be unescaped from~1to get correct path item key . (see Apitomy/apitomy-data-models#858).The second error during dereference is because the
Dereferencerclass in apicurio-data-models doesn't implement path item case. It tries to add the referenced node intocomponentsand then change originel external ref to an internal one. But path items can't be defined in components. The referenced node is supposed to be "merged" according the spec.Proposed fix
I can write a PR to fix the second issue. I propose to do a simple non recursive merge of the external path item properties into the internal one and ignore external path item properties if they are already defined in internal path item (since spec says
In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined).