How to use the apicurio-data-models.TraverserDirection.down function in apicurio-data-models

To help you get started, we’ve selected a few apicurio-data-models examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Apicurio / apicurio-studio / front-end / studio / src / app / pages / apis / {apiId} / editor / _components / common / validation-aggregate.component.ts View on Github external
public matchingProblems(): ValidationProblem[] {
        if (!this.models) {
            return [];
        }

        // Find the relevant problems if not cached.
        if (this._problems === undefined) {
            this.log("Cache empty, finding matching problems.");
            let finder: ProblemFinder = new ProblemFinder(this.properties, this.codes);
            for (let model of this.models) {
                if (model !== null && model !== undefined) {
                    if (this.shallow) {
                        VisitorUtil.visitNode(model, finder);
                    } else {
                        VisitorUtil.visitTree(model, finder, TraverserDirection.down);
                    }
                }
            }
            this._problems = finder.getProblems();
        }

        return this._problems;
    }
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / apis / {apiId} / editor / _components / common / validation-problem.component.ts View on Github external
public validationProblems(): ValidationProblem[] {
        if (this._problems === undefined) {
            if (this._model) {

                if (this.debug) {
                    console.info("Getting the list of problems!");
                }

                let props: string[] = this.property ? [this.property] : null;
                let codes: string[] = this.code ? [this.code] : null;
                let finder: ProblemFinder = new ProblemFinder(props, codes);

                if (this.shallow) {
                    VisitorUtil.visitNode(this.model, finder);
                } else {
                    VisitorUtil.visitTree(this.model, finder, TraverserDirection.down);
                }

                this._problems = finder.getProblems();
            } else {
                this._problems = [];
            }
        }
        return this._problems;
    }
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / apis / {apiId} / editor / _components / forms / shared / schema-type-editor.component.ts View on Github external
private getSchemaDefinitionsOptions(): DropDownOption[] {
        let options: DropDownOption[] = [];
        let refPrefix: string = "#/components/schemas/";
        if (this.document.is2xDocument()) {
            refPrefix = "#/definitions/";
        }

        let viz: FindSchemaDefinitionsVisitor = new FindSchemaDefinitionsVisitor(null);
        VisitorUtil.visitTree(this.document, viz, TraverserDirection.down);
        let defs: (Oas20SchemaDefinition | Oas30SchemaDefinition)[] = viz.getSortedSchemaDefinitions();
        if (defs.length > 0) {
            options.push(DIVIDER);
            defs.forEach(def => {
                let defName: string = def.getName();
                options.push(new Value(defName, refPrefix + defName));
            });
        }
        return options;
    }
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / apis / {apiId} / editor / _components / dialogs / rename-path.component.ts View on Github external
private getPaths(document: OasDocument): (Oas20PathItem | Oas30PathItem)[] {
        let vizzy: FindPathItemsVisitor = new FindPathItemsVisitor(null);
        VisitorUtil.visitTree(document, vizzy, TraverserDirection.down);
        return vizzy.getSortedPathItems() as (Oas20PathItem | Oas30PathItem)[];
    }
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / apis / {apiId} / editor / _components / dialogs / clone-definition.component.ts View on Github external
private getDefinitions(document: OasDocument): (Oas20SchemaDefinition | Oas30SchemaDefinition)[] {
        let vizzy: FindSchemaDefinitionsVisitor = new FindSchemaDefinitionsVisitor(null);
        VisitorUtil.visitTree(document, vizzy, TraverserDirection.down);
        return vizzy.getSortedSchemaDefinitions()
    }
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / apis / {apiId} / editor / _components / editors / security-scheme-editor.component.ts View on Github external
protected initModel(scheme?: SecurityScheme): void {
        this.schemeExists = false;
        let schemeNames: string[] = [];
        VisitorUtil.visitTree(this.context.ownerDocument(), new class extends CombinedVisitorAdapter {
            public visitSecurityScheme(node: SecurityScheme): void {
                schemeNames.push(node.getName());
            }
        }, TraverserDirection.down);
        this.schemeNames = schemeNames;

        if (this.context.ownerDocument().getDocumentType() == DocumentType.openapi2) {
            this.model = {
                schemeName: null,
                description: null,
                type: null,
                name: null,
                in: null,
                flow: null,
                authorizationUrl: null,
                tokenUrl: null,
                scopes: []
            } as SecurityScheme20Data;
        } else {
            this.model = {