in packages/azure-openapi-validator/core/src/swaggerInventory.ts [62:82]
async cacheDocument(specPath: string) {
const cache = this.allDocs.get(specPath)
if (cache) {
return cache
}
const parser = new JsonParser()
const document = new OpenapiDocument(specPath, parser, this.fileSystem)
await document.resolve()
this.referenceCache.set(specPath, document)
this.allDocs.set(specPath, document.getObj())
this.inventory.addNode(specPath)
const references = document.getReferences()
for (const ref of references) {
if (!this.allDocs.has(ref)) {
this.inventory.addNode(ref)
await this.cacheDocument(ref)
}
this.inventory.addDependency(specPath, ref)
}
return document
}