fastman
Version:
快速api测试及文档生成
1,250 lines • 41.6 kB
JavaScript
"use strict";
/**
* @license
* Copyright 2017 Red Hat
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Used to traverse an OAS tree and call an included visitor for each node.
*/
var OasTraverser = /** @class */ (function () {
/**
* Constructor.
* @param visitor
*/
function OasTraverser(visitor) {
this.visitor = visitor;
}
/**
* Called to traverse an OAS 2.0 tree starting at the given node and traversing
* down until this node and all child nodes have been visited.
* @param node
*/
OasTraverser.prototype.traverse = function (node) {
node.accept(this);
};
/**
* Traverse into the given node, unless it's null.
* @param node
*/
OasTraverser.prototype.traverseIfNotNull = function (node) {
if (node) {
node.accept(this);
}
};
/**
* Traverse the items of the given array.
* @param items
*/
OasTraverser.prototype.traverseArray = function (items) {
if (Array.isArray(items)) {
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
var item = items_1[_i];
this.traverseIfNotNull(item);
}
}
};
/**
* Traverse the children of an indexed node.
* @param indexedNode
*/
OasTraverser.prototype.traverseIndexedNode = function (indexedNode) {
var itemNames = indexedNode.getItemNames();
if (itemNames && itemNames.length > 0) {
for (var _i = 0, itemNames_1 = itemNames; _i < itemNames_1.length; _i++) {
var itemName = itemNames_1[_i];
var item = indexedNode.getItem(itemName);
this.traverseIfNotNull(item);
}
}
};
/**
* Traverse the extension nodes, if any are found.
* @param node
*/
OasTraverser.prototype.traverseExtensions = function (node) {
this.traverseArray(node.extensions());
};
/**
* Traverse the validation problems, if any exist. Validation problems would
* only exist if validation has been performed on the data model.
* @param {OasNode} node
*/
OasTraverser.prototype.traverseValidationProblems = function (node) {
this.traverseArray(node.validationProblems());
};
/**
* Visit the info object.
* @param node
*/
OasTraverser.prototype.visitInfo = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.contact);
this.traverseIfNotNull(node.license);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the contact object.
* @param node
*/
OasTraverser.prototype.visitContact = function (node) {
node.accept(this.visitor);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the license object.
* @param node
*/
OasTraverser.prototype.visitLicense = function (node) {
node.accept(this.visitor);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the paths.
* @param node
*/
OasTraverser.prototype.visitPaths = function (node) {
node.accept(this.visitor);
this.traverseIndexedNode(node);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the responses.
* @param node
*/
OasTraverser.prototype.visitResponses = function (node) {
node.accept(this.visitor);
this.traverseIndexedNode(node);
this.traverseIfNotNull(node.default);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the scopes.
* @param node
*/
OasTraverser.prototype.visitXML = function (node) {
node.accept(this.visitor);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the security requirement.
* @param node
*/
OasTraverser.prototype.visitSecurityRequirement = function (node) {
node.accept(this.visitor);
this.traverseValidationProblems(node);
};
/**
* Visit the tag.
* @param node
*/
OasTraverser.prototype.visitTag = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.externalDocs);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the external doc.
* @param node
*/
OasTraverser.prototype.visitExternalDocumentation = function (node) {
node.accept(this.visitor);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the extension.
* @param node
*/
OasTraverser.prototype.visitExtension = function (node) {
node.accept(this.visitor);
this.traverseValidationProblems(node);
};
/**
* Visit the validation problem.
* @param {OasValidationProblem} node
*/
OasTraverser.prototype.visitValidationProblem = function (node) {
node.accept(this);
// Don't traverse the validation problem's validation problems. :)
};
return OasTraverser;
}());
exports.OasTraverser = OasTraverser;
/**
* Used to traverse an OAS 2.0 tree and call an included visitor for each node.
*/
var Oas20Traverser = /** @class */ (function (_super) {
__extends(Oas20Traverser, _super);
/**
* Constructor.
* @param visitor
*/
function Oas20Traverser(visitor) {
return _super.call(this, visitor) || this;
}
/**
* Visit the document.
* @param node
*/
Oas20Traverser.prototype.visitDocument = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.info);
this.traverseIfNotNull(node.paths);
this.traverseIfNotNull(node.definitions);
this.traverseIfNotNull(node.parameters);
this.traverseIfNotNull(node.responses);
this.traverseIfNotNull(node.securityDefinitions);
this.traverseArray(node.security);
this.traverseArray(node.tags);
this.traverseIfNotNull(node.externalDocs);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the path item.
* @param node
*/
Oas20Traverser.prototype.visitPathItem = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.get);
this.traverseIfNotNull(node.put);
this.traverseIfNotNull(node.post);
this.traverseIfNotNull(node.delete);
this.traverseIfNotNull(node.options);
this.traverseIfNotNull(node.head);
this.traverseIfNotNull(node.patch);
this.traverseArray(node.parameters);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the operation.
* @param node
*/
Oas20Traverser.prototype.visitOperation = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.externalDocs);
this.traverseArray(node.parameters);
this.traverseIfNotNull(node.responses);
this.traverseArray(node.security);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit a parameter.
* @param node
*/
Oas20Traverser.prototype.visitParameterBase = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.schema);
this.traverseIfNotNull(node.items);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the parameter.
* @param node
*/
Oas20Traverser.prototype.visitParameter = function (node) {
this.visitParameterBase(node);
};
/**
* Visit the parameter definition.
* @param node
*/
Oas20Traverser.prototype.visitParameterDefinition = function (node) {
this.visitParameterBase(node);
};
Oas20Traverser.prototype.visitResponseBase = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.schema);
this.traverseIfNotNull(node.headers);
this.traverseIfNotNull(node.examples);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the response.
* @param node
*/
Oas20Traverser.prototype.visitResponse = function (node) {
this.visitResponseBase(node);
};
/**
* Visit the headers.
* @param node
*/
Oas20Traverser.prototype.visitHeaders = function (node) {
node.accept(this.visitor);
this.traverseIndexedNode(node);
this.traverseValidationProblems(node);
};
/**
* Visit the response definition.
* @param node
*/
Oas20Traverser.prototype.visitResponseDefinition = function (node) {
this.visitResponseBase(node);
};
/**
* Visit the schema.
* @param node
*/
Oas20Traverser.prototype.visitSchema = function (node) {
node.accept(this.visitor);
if (node.items !== null && Array.isArray(node.items)) {
this.traverseArray(node.items);
}
else {
this.traverseIfNotNull(node.items);
}
this.traverseArray(node.allOf);
var propNames = node.propertyNames();
if (propNames && propNames.length > 0) {
for (var _i = 0, propNames_1 = propNames; _i < propNames_1.length; _i++) {
var propName = propNames_1[_i];
var prop = node.property(propName);
this.traverseIfNotNull(prop);
}
}
if (typeof node.additionalProperties !== "boolean") {
this.traverseIfNotNull(node.additionalProperties);
}
this.traverseIfNotNull(node.xml);
this.traverseIfNotNull(node.externalDocs);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the schema.
* @param node
*/
Oas20Traverser.prototype.visitPropertySchema = function (node) {
this.visitSchema(node);
};
/**
* Visit the schema.
* @param node
*/
Oas20Traverser.prototype.visitSchemaDefinition = function (node) {
this.visitSchema(node);
};
/**
* Visit the schema.
* @param node
*/
Oas20Traverser.prototype.visitAdditionalPropertiesSchema = function (node) {
this.visitSchema(node);
};
/**
* Visit the schema.
* @param node
*/
Oas20Traverser.prototype.visitAllOfSchema = function (node) {
this.visitSchema(node);
};
/**
* Visit the schema.
* @param node
*/
Oas20Traverser.prototype.visitItemsSchema = function (node) {
this.visitSchema(node);
};
/**
* Visit the header.
* @param node
*/
Oas20Traverser.prototype.visitHeader = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.items);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the example.
* @param node
*/
Oas20Traverser.prototype.visitExample = function (node) {
node.accept(this.visitor);
this.traverseValidationProblems(node);
};
/**
* Visit the items.
* @param node
*/
Oas20Traverser.prototype.visitItems = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.items);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the security definitions.
* @param node
*/
Oas20Traverser.prototype.visitSecurityDefinitions = function (node) {
node.accept(this.visitor);
this.traverseIndexedNode(node);
this.traverseValidationProblems(node);
};
/**
* Visit the security scheme.
* @param node
*/
Oas20Traverser.prototype.visitSecurityScheme = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.scopes);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the scopes.
* @param node
*/
Oas20Traverser.prototype.visitScopes = function (node) {
node.accept(this.visitor);
this.traverseValidationProblems(node);
};
/**
* Visit the definitions.
* @param node
*/
Oas20Traverser.prototype.visitDefinitions = function (node) {
node.accept(this.visitor);
this.traverseIndexedNode(node);
this.traverseValidationProblems(node);
};
/**
* Visit the definitions.
* @param node
*/
Oas20Traverser.prototype.visitParametersDefinitions = function (node) {
node.accept(this.visitor);
this.traverseIndexedNode(node);
this.traverseValidationProblems(node);
};
/**
* Visit the responses.
* @param node
*/
Oas20Traverser.prototype.visitResponsesDefinitions = function (node) {
node.accept(this.visitor);
this.traverseIndexedNode(node);
this.traverseValidationProblems(node);
};
return Oas20Traverser;
}(OasTraverser));
exports.Oas20Traverser = Oas20Traverser;
/**
* Used to traverse an OAS 3.0 tree and call an included visitor for each node.
*/
var Oas30Traverser = /** @class */ (function (_super) {
__extends(Oas30Traverser, _super);
/**
* Constructor.
* @param visitor
*/
function Oas30Traverser(visitor) {
return _super.call(this, visitor) || this;
}
/**
* Visit the document.
* @param node
*/
Oas30Traverser.prototype.visitDocument = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.info);
this.traverseArray(node.servers);
this.traverseIfNotNull(node.paths);
this.traverseIfNotNull(node.components);
this.traverseArray(node.security);
this.traverseArray(node.tags);
this.traverseIfNotNull(node.externalDocs);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitPathItem = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.get);
this.traverseIfNotNull(node.put);
this.traverseIfNotNull(node.post);
this.traverseIfNotNull(node.delete);
this.traverseIfNotNull(node.options);
this.traverseIfNotNull(node.head);
this.traverseIfNotNull(node.patch);
this.traverseIfNotNull(node.trace);
this.traverseArray(node.parameters);
this.traverseArray(node.servers);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitOperation = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.externalDocs);
this.traverseArray(node.parameters);
this.traverseIfNotNull(node.responses);
this.traverseIfNotNull(node.requestBody);
this.traverseArray(node.getCallbacks());
this.traverseArray(node.security);
this.traverseArray(node.servers);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitHeader = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.schema);
this.traverseArray(node.getExamples());
this.traverseArray(node.getMediaTypes());
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitSchema = function (node) {
node.accept(this.visitor);
if (Array.isArray(node.items)) {
this.traverseArray(node.items);
}
else {
this.traverseIfNotNull(node.items);
}
this.traverseArray(node.allOf);
var propNames = node.propertyNames();
if (propNames && propNames.length > 0) {
for (var _i = 0, propNames_2 = propNames; _i < propNames_2.length; _i++) {
var propName = propNames_2[_i];
var prop = node.property(propName);
this.traverseIfNotNull(prop);
}
}
if (typeof node.additionalProperties !== "boolean") {
this.traverseIfNotNull(node.additionalProperties);
}
this.traverseArray(node.oneOf);
this.traverseArray(node.anyOf);
this.traverseIfNotNull(node.not);
this.traverseIfNotNull(node.discriminator);
this.traverseIfNotNull(node.xml);
this.traverseIfNotNull(node.externalDocs);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitDiscriminator = function (node) {
node.accept(this.visitor);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitParameter = function (node) {
this.visitParameterBase(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitParameterDefinition = function (node) {
this.visitParameterBase(node);
};
/**
* Visit a parameter.
* @param node
*/
Oas30Traverser.prototype.visitParameterBase = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.schema);
this.traverseArray(node.getExamples());
this.traverseArray(node.getMediaTypes());
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitResponse = function (node) {
this.visitResponseBase(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitResponseDefinition = function (node) {
this.visitResponseBase(node);
};
/**
* Visit a response.
* @param node
*/
Oas30Traverser.prototype.visitResponseBase = function (node) {
node.accept(this.visitor);
this.traverseArray(node.getMediaTypes());
this.traverseArray(node.getLinks());
this.traverseArray(node.getHeaders());
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitLink = function (node) {
node.accept(this.visitor);
this.traverseArray(node.getLinkParameterExpressions());
this.traverseIfNotNull(node.requestBody);
this.traverseIfNotNull(node.server);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitLinkParameterExpression = function (node) {
node.accept(this.visitor);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitLinkRequestBodyExpression = function (node) {
node.accept(this.visitor);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitLinkServer = function (node) {
this.visitServer(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitRequestBody = function (node) {
node.accept(this.visitor);
this.traverseArray(node.getMediaTypes());
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitMediaType = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.schema);
this.traverseArray(node.getExamples());
this.traverseArray(node.getEncodings());
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitEncoding = function (node) {
node.accept(this.visitor);
this.traverseArray(node.getHeaders());
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitExample = function (node) {
node.accept(this.visitor);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitCallback = function (node) {
node.accept(this.visitor);
this.traverseIndexedNode(node);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitCallbackPathItem = function (node) {
this.visitPathItem(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitAllOfSchema = function (node) {
this.visitSchema(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitAnyOfSchema = function (node) {
this.visitSchema(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitOneOfSchema = function (node) {
this.visitSchema(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitNotSchema = function (node) {
this.visitSchema(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitPropertySchema = function (node) {
this.visitSchema(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitItemsSchema = function (node) {
this.visitSchema(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitAdditionalPropertiesSchema = function (node) {
this.visitSchema(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitComponents = function (node) {
node.accept(this.visitor);
this.traverseArray(node.getSchemaDefinitions());
this.traverseArray(node.getResponseDefinitions());
this.traverseArray(node.getParameterDefinitions());
this.traverseArray(node.getExampleDefinitions());
this.traverseArray(node.getRequestBodyDefinitions());
this.traverseArray(node.getHeaderDefinitions());
this.traverseArray(node.getSecuritySchemes());
this.traverseArray(node.getLinkDefinitions());
this.traverseArray(node.getCallbackDefinitions());
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitExampleDefinition = function (node) {
this.visitExample(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitRequestBodyDefinition = function (node) {
this.visitRequestBody(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitHeaderDefinition = function (node) {
this.visitHeader(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitSecurityScheme = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.flows);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitOAuthFlows = function (node) {
node.accept(this.visitor);
this.traverseIfNotNull(node.implicit);
this.traverseIfNotNull(node.password);
this.traverseIfNotNull(node.clientCredentials);
this.traverseIfNotNull(node.authorizationCode);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitImplicitOAuthFlow = function (node) {
this.visitOAuthFlow(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitPasswordOAuthFlow = function (node) {
this.visitOAuthFlow(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitClientCredentialsOAuthFlow = function (node) {
this.visitOAuthFlow(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitAuthorizationCodeOAuthFlow = function (node) {
this.visitOAuthFlow(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitOAuthFlow = function (node) {
node.accept(this.visitor);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitLinkDefinition = function (node) {
this.visitLink(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitCallbackDefinition = function (node) {
this.visitCallback(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitSchemaDefinition = function (node) {
this.visitSchema(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitServer = function (node) {
node.accept(this.visitor);
this.traverseArray(node.getServerVariables());
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
/**
* Visit the node.
* @param node
*/
Oas30Traverser.prototype.visitServerVariable = function (node) {
node.accept(this.visitor);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
};
return Oas30Traverser;
}(OasTraverser));
exports.Oas30Traverser = Oas30Traverser;
/**
* Used to traverse up an OAS tree and call an included visitor for each node.
*/
var OasReverseTraverser = /** @class */ (function () {
/**
* Constructor.
* @param visitor
*/
function OasReverseTraverser(visitor) {
this.visitor = visitor;
}
/**
* Traverse the given node.
* @param node
*/
OasReverseTraverser.prototype.traverse = function (node) {
node.accept(this);
};
OasReverseTraverser.prototype.visitDocument = function (node) {
node.accept(this.visitor);
};
OasReverseTraverser.prototype.visitInfo = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitContact = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitLicense = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitPaths = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitPathItem = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitOperation = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitResponses = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitSchema = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitHeader = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitXML = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitSecurityScheme = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitSecurityRequirement = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitTag = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitExternalDocumentation = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitExtension = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
OasReverseTraverser.prototype.visitValidationProblem = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
return OasReverseTraverser;
}());
exports.OasReverseTraverser = OasReverseTraverser;
/**
* Used to traverse up an OAS 2.0 tree and call an included visitor for each node.
*/
var Oas20ReverseTraverser = /** @class */ (function (_super) {
__extends(Oas20ReverseTraverser, _super);
/**
* Constructor.
* @param visitor
*/
function Oas20ReverseTraverser(visitor) {
return _super.call(this, visitor) || this;
}
Oas20ReverseTraverser.prototype.visitParameter = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitParameterDefinition = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitResponse = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitHeaders = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitResponseDefinition = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitExample = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitItems = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitSecurityDefinitions = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitScopes = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitSchemaDefinition = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitPropertySchema = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitAdditionalPropertiesSchema = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitAllOfSchema = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitItemsSchema = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitDefinitions = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitParametersDefinitions = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas20ReverseTraverser.prototype.visitResponsesDefinitions = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
return Oas20ReverseTraverser;
}(OasReverseTraverser));
exports.Oas20ReverseTraverser = Oas20ReverseTraverser;
/**
* Used to traverse up an OAS 3.0 tree and call an included visitor for each node.
*/
var Oas30ReverseTraverser = /** @class */ (function (_super) {
__extends(Oas30ReverseTraverser, _super);
/**
* Constructor.
* @param visitor
*/
function Oas30ReverseTraverser(visitor) {
return _super.call(this, visitor) || this;
}
Oas30ReverseTraverser.prototype.visitParameter = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitParameterDefinition = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitResponse = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitLink = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitLinkParameterExpression = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitLinkRequestBodyExpression = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitLinkServer = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitResponseDefinition = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitRequestBody = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitMediaType = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitEncoding = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitExample = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitCallback = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitCallbackPathItem = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitAllOfSchema = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitAnyOfSchema = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitOneOfSchema = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitNotSchema = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitPropertySchema = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitItemsSchema = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitAdditionalPropertiesSchema = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitDiscriminator = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitComponents = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitExampleDefinition = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitRequestBodyDefinition = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitHeaderDefinition = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitOAuthFlows = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitImplicitOAuthFlow = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitPasswordOAuthFlow = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitClientCredentialsOAuthFlow = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitAuthorizationCodeOAuthFlow = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitLinkDefinition = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitCallbackDefinition = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitSchemaDefinition = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitServer = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
Oas30ReverseTraverser.prototype.visitServerVariable = function (node) {
node.accept(this.visitor);
this.traverse(node.parent());
};
return Oas30ReverseTraverser;
}(OasReverseTraverser));
exports.Oas30ReverseTraverser = Oas30ReverseTraverser;
//# sourceMappingURL=traverser.js.map