Description
Hi everybody, not sure if this is the right place to ask this, but I've intercepted an ambiguity while building tooling for OAS 3.1
{
"openapi": "3.1.0",
"components": {
"pathItems": {
"pathItem1": {
"$ref": "#/components/pathItems/pathItem2",
},
"pathItem2": {
"summary": "path item summary",
"description": "path item description",
"get": {}
}
}
}
}
Given following document, pathItem1 can be interpreted either as Reference Object or Path Item Object. It's hard to tell what the author intended. He could have intended for pathItem1 to be a Reference Object. Or he may have intended pathItem1 to be a Path Item Object. As Path Item Object can have exactly the same shape as Reference Object the intention of the author is lost.
Can you please advice how to approach that?
Instead of having this ambiguity and $ref
field in Path Item Object, wouldn't it be cleaner to use Reference Object explicitly in every place where Path Item Object is allowed?
Current workaround could be assert the presence of $ref
field and one of the other fixed fields from Path Item Object (like get
, post
, etc...). If assertion like that passes, we can say with limited certainty that author intended to define a Path Item Object.