Description
I never got an answer to this question from #2092 ($id
scope resolution):
If I put a non-Schema Object (like a Response Object) in its own file, what is the base URI for Reference Objects in that file? In particular, is
#/components/whatever
expected to work (because it is resolved relative to the primary OAS file) or fail (because Response Objects don't have a components property, and the file's base URI is distinct from the primary OAS document file)?
Regarding $id
and particularly $anchor
, this also impacts how something like {"$ref": "#foo"}
is resolved. In the main file you might have:
components:
schemas:
fooSchema:
$anchor: foo
type: object
properties: {...}
barSchema:
type: object
properties:
someFoo: {$ref: "#foo"}
In this example, the someFoo
property of the barSchema
schema references the fooSchema
schema using the fragment created by $anchor
. That fragment is attached to the base URI for the overall OAS file, so the same question about #/components/schemas/fooSchema
from a separate file exists for #foo
from a separate file.
@OAI/tsc