How to use apicurio-data-models - 10 common examples

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 / _services / selection.service.ts View on Github external
public select(path: string): void {
        // Clear previous selection
        this.clearCurrentSelection();

        // Select the new thing
        let doc: Document = this.documentService.currentDocument();
        let visitor: MainSelectionVisitor = new MainSelectionVisitor();
        let npath: NodePath = new NodePath(path);
        npath.resolveWithVisitor(doc, visitor);

        // Fire an event with the new selection path
        this._selectionTopic.send(path);
    }
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / settings / validation / validation.page.ts View on Github external
ruleset.getAllRules().forEach( rule => {
                // Severity is always high.
                newProfile.severities[rule.code] = ValidationProblemSeverity.high;
            });
        } else {
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / settings / validation / validation.page.ts View on Github external
ruleset.getAllRules().forEach( rule => {
                // Severity is "medium" if the rule is spec mandated otherwise it's "ignore"
                newProfile.severities[rule.code] = rule.specMandated ? ValidationProblemSeverity.medium : ValidationProblemSeverity.ignore;
            });
        } else if (profile.id == -3) { // Enable all rules
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 / settings / validation / validation.page.ts View on Github external
ruleset.getAllRules().forEach( rule => {
                newProfile.severities[rule.code] = ValidationProblemSeverity.ignore;
            });
        } else if (profile.id == -2) { // OpenAPI spec-only
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / apis / {apiId} / editor / _components / forms / path / operation / info-section.component.ts View on Github external
public changeOperationId(newOperationId: string): void {
        console.info("[InfoSectionComponent] User changed the operationId.");
        let command: ICommand = CommandFactory.createChangePropertyCommand(this.operation, "operationId", newOperationId);
        this.commandService.emit(command);
    }
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / apis / {apiId} / editor / _components / forms / path / operation / info-section.component.ts View on Github external
public onProducesChange(newValue: string[]): void {
        console.info("[InfoSectionComponent] User changed the produces to: ", newValue);
        if (newValue && newValue.length === 0) {
            newValue = null;
        }
        let command: ICommand = CommandFactory.createChangePropertyCommand(this.operation, "produces", newValue);
        this.commandService.emit(command);
        this._initConsumesProduces();
    }
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / apis / {apiId} / editor / _components / forms / path / operation / info-section.component.ts View on Github external
public onConsumesChange(newValue: string[]): void {
        console.info("[InfoSectionComponent] User changed the consumes to: ", newValue);
        if (newValue && newValue.length === 0) {
            newValue = null;
        }
        let command: ICommand = CommandFactory.createChangePropertyCommand(this.operation, "consumes", newValue);
        this.commandService.emit(command);
        this._initConsumesProduces();
    }
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / apis / {apiId} / editor / _components / forms / definition / example-section.component.ts View on Github external
public onExampleChange(newExample: string): void {
        console.info("[DefinitionExampleSectionComponent] User changed the data type example.");
        let newValue: any = newExample;
        if (StringUtils.isJSON(newValue)) {
            try {
                newValue = JSON.parse(newValue);
            } catch (e) {
                console.info("[DefinitionExampleSectionComponent] Failed to parse example: ", e);
            }
        }
        let command: ICommand = CommandFactory.createChangePropertyCommand(this.definition,"example", newValue);
        this.commandService.emit(command);
    }