Search in sources :

Example 1 with Oas20SecurityRequirement

use of io.apicurio.datamodels.openapi.v2.models.Oas20SecurityRequirement in project apicurio-data-models by Apicurio.

the class Oas20to30TransformationVisitor method visitSecurityRequirement.

/**
 * @see io.apicurio.datamodels.core.visitors.IVisitor#visitSecurityRequirement(io.apicurio.datamodels.core.models.common.SecurityRequirement)
 */
@Override
public void visitSecurityRequirement(SecurityRequirement node) {
    Oas20SecurityRequirement req = (Oas20SecurityRequirement) node;
    ISecurityRequirementParent parent30 = (ISecurityRequirementParent) this.lookup(req.parent());
    Oas30SecurityRequirement securityRequirement30 = (Oas30SecurityRequirement) parent30.createSecurityRequirement();
    parent30.addSecurityRequirement(securityRequirement30);
    req.getSecurityRequirementNames().forEach(name -> {
        securityRequirement30.addSecurityRequirementItem(name, req.getScopes(name));
    });
    this.mapNode(req, securityRequirement30);
}
Also used : Oas30SecurityRequirement(io.apicurio.datamodels.openapi.v3.models.Oas30SecurityRequirement) Oas20SecurityRequirement(io.apicurio.datamodels.openapi.v2.models.Oas20SecurityRequirement) ISecurityRequirementParent(io.apicurio.datamodels.core.models.common.ISecurityRequirementParent)

Aggregations

ISecurityRequirementParent (io.apicurio.datamodels.core.models.common.ISecurityRequirementParent)1 Oas20SecurityRequirement (io.apicurio.datamodels.openapi.v2.models.Oas20SecurityRequirement)1 Oas30SecurityRequirement (io.apicurio.datamodels.openapi.v3.models.Oas30SecurityRequirement)1