@microsoft.azure/openapi-validator-core
Version:
Azure OpenAPI Validator
37 lines • 1.15 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpenapiDocument = void 0;
const resolver_1 = require("./resolver");
class OpenapiDocument {
constructor(_specPath, parser, fileSystem) {
this._specPath = _specPath;
this.parser = parser;
this.fileSystem = fileSystem;
this._content = undefined;
this._doc = undefined;
}
async resolve() {
this._content = await this.fileSystem.read(this._specPath);
this.jsonInstance = this.parser.parse(this._content);
this._doc = this.jsonInstance.getValue();
this.resolver = new resolver_1.Resolver(this._doc, this._specPath);
await this.resolver.resolve();
}
getObj() {
return this._doc;
}
getContent() {
return this._content;
}
getReferences() {
return this.resolver.getReferences();
}
getDocumentPath() {
return this._specPath;
}
getPositionFromJsonPath(jsonPath) {
return this.jsonInstance.getLocation(jsonPath);
}
}
exports.OpenapiDocument = OpenapiDocument;
//# sourceMappingURL=document.js.map