Closed EdVinyard closed 1 year ago
I'll give it a look.
As a quick workaround, we could just use decycle
in the api-design to fully mitigate the risk.
I believe what we'd want is the following:
const input = {
openapi: '3.0.0',
paths: {},
components: {
schemas: {
User: {
$ref: '#',
},
},
},
};
const output = bundleTarget({ document: input, path: '#/components', bundleRoot: '#/$defs' });
expect(output).toStrictEqual({
schemas: {
User: {
$ref: '#/$defs/root',
},
},
$defs: {
root: {
openapi: '3.0.0',
paths: {},
components: {
$ref: '#'
},
},
},
});
this would be valid for both OAS ("valid" in the sense that semantics would be unchanged, but obviously it still wouldn't make any sense because you cannot really reference an oas document like that) & JSON Schemas
superseded by https://github.com/stoplightio/json/pull/121
based on api-design outage, starting with PCRecruiter-supplied example OpenAPI document
"$ref": "#"
is our kryptonite.see https://stoplight-internal.slack.com/archives/CUBL8DMRP/p1675872847844529