Search in sources :

Example 1 with RefPath

use of io.swagger.models.RefPath in project swagger-parser by swagger-api.

the class SwaggerConverter method convert.

public PathItem convert(Path v2Path) {
    PathItem v3Path = new PathItem();
    if (v2Path instanceof RefPath) {
        v3Path.set$ref(((RefPath) v2Path).get$ref());
    } else {
        if (v2Path.getParameters() != null) {
            for (io.swagger.models.parameters.Parameter param : v2Path.getParameters()) {
                v3Path.addParametersItem(convert(param));
            }
        }
        io.swagger.models.Operation v2Operation;
        v2Operation = v2Path.getGet();
        if (v2Operation != null) {
            v3Path.setGet(convert(v2Operation));
        }
        v2Operation = v2Path.getPut();
        if (v2Operation != null) {
            v3Path.setPut(convert(v2Operation));
        }
        v2Operation = v2Path.getPost();
        if (v2Operation != null) {
            v3Path.setPost(convert(v2Operation));
        }
        v2Operation = v2Path.getPatch();
        if (v2Operation != null) {
            v3Path.setPatch(convert(v2Operation));
        }
        v2Operation = v2Path.getDelete();
        if (v2Operation != null) {
            v3Path.setDelete(convert(v2Operation));
        }
        v2Operation = v2Path.getHead();
        if (v2Operation != null) {
            v3Path.setHead(convert(v2Operation));
        }
        v2Operation = v2Path.getOptions();
        if (v2Operation != null) {
            v3Path.setOptions(convert(v2Operation));
        }
        v3Path.setExtensions(convert(v2Path.getVendorExtensions()));
    }
    return v3Path;
}
Also used : PathItem(io.swagger.v3.oas.models.PathItem) RefPath(io.swagger.models.RefPath)

Aggregations

RefPath (io.swagger.models.RefPath)1 PathItem (io.swagger.v3.oas.models.PathItem)1