Description
while dereferencing the schema my logic written inside custom resolver is not getting executed because I think its just checking the absolute path and returns the resolved value from the cache.
Code is:
$RefParser.dereference(schemaObject, {
abc: {
order: 1,
canRead: /^abc:/i,
read: async (file, callback) => {
const id = file.url.replace(/^abc:/, '');
const result = await api.fetchResource(id);
const resolvedSchema = structuredClone(result);
callback(null, resolvedSchema)
}
}
});
in this case if I am having two $ref like "abc:12345#/schema/firstSchema" and "abc:12345#/schema/secondSchema".
then first time it will go inside custom resolver but for the second ref it is not going.
Is there anyway I can prevent this because I wanted to add a check inside custom resolver itself to check if the schema mentioned in relative path exists or not, if not then it should return {} instead of throwing error.