How to use the apicurio-data-models.DocumentType.openapi2 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} / copy / copy.page.ts View on Github external
public cloneApi(): string {
        let sourceDoc: Document = this.document;
        CommandFactory.createChangeTitleCommand(this.title).execute(sourceDoc);
        if (sourceDoc.getDocumentType() == DocumentType.openapi2 && this.convertApi) {
            console.info("[CopyPageComponent] Converting API from 2.0 to 3.0.x!");
            sourceDoc = this.transformDocument(sourceDoc as Oas20Document);
        }
        let sourceJs: any = Library.writeNode(sourceDoc);
        let sourceStr: string = JSON.stringify(sourceJs);
        let sourceB64: string = Base64.encode(sourceStr);
        return sourceB64;
    }
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / apis / {apiId} / editor / _components / editors / security-scheme-editor.component.ts View on Github external
refreshUrl: null,
                        scopes: []
                    },
                    authorizationCode: {
                        enabled: false,
                        authorizationUrl: null,
                        tokenUrl: null,
                        refreshUrl: null,
                        scopes: []
                    }
                }
            } as SecurityScheme30Data;
        }

        if (scheme) {
            if (this.context.ownerDocument().getDocumentType() == DocumentType.openapi2) {
                let scheme20: Oas20SecurityScheme = scheme as Oas20SecurityScheme;
                this.model.schemeName = scheme20.getSchemeName();
                this.model.description = scheme20.description;
                this.model.type = scheme20.type;
                this.model.in = scheme20.in;
                this.model.name = scheme20.name;
                this.model.flow = scheme20.flow;
                this.model.authorizationUrl = scheme20.authorizationUrl;
                this.model.tokenUrl = scheme20.tokenUrl;
                this.model.scopes = this.toScopesArray(scheme20.scopes);
            } else {
                let scheme30: Oas30SecurityScheme = scheme as Oas30SecurityScheme;
                let model: SecurityScheme30Data = this.model as SecurityScheme30Data;
                model.schemeName = scheme30.getSchemeName();
                model.description = scheme30.description;
                model.type = scheme30.type;
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / settings / validation / _components / profile-editor.component.ts View on Github external
getFilterValue(filter: ValidationRuleFilter): string {
        if (filter.type === "severity") {
            if (filter.value === ValidationProblemSeverity.ignore) {
                return "None";
            } else if (filter.value === ValidationProblemSeverity.low) {
                return "Low";
            } else if (filter.value === ValidationProblemSeverity.medium) {
                return "Medium";
            } else if (filter.value === ValidationProblemSeverity.high) {
                return "High";
            }
        }
        if (filter.type === "version") {
            if (filter.value == DocumentType.openapi2) {
                return "OpenAPI 2.0";
            }
            if (filter.value == DocumentType.openapi3) {
                return "OpenAPI 3.x";
            }
            if (filter.value == DocumentType.asyncapi2) {
                return "AsyncAPI 2.x";
            }
        }
        return filter.value;
    }
github Apicurio / apicurio-studio / front-end / studio / src / app / pages / apis / {apiId} / editor / _components / forms / path / operation / response-tab-30.component.ts View on Github external
responseDefRefPrefix(): string {
        let prefix: string = "#/components/responses/";
        if (this.response.ownerDocument().getDocumentType() === DocumentType.openapi2) {
            prefix = "#/responses/";
        }
        return prefix;
    }