Java Code Examples for io.swagger.v3.oas.models.PathItem#setHead()

The following examples show how to use io.swagger.v3.oas.models.PathItem#setHead() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OperationsTransformer.java    From spring-openapi with MIT License 5 votes vote down vote up
private void setContentBasedOnHttpMethod(PathItem pathItem, RequestMethod[] method, Operation operation) {
	if (method == null || method.length == 0) {
		throw new IllegalArgumentException("RequestMethod in RequestMapping must have at least one value");
	}
	RequestMethod requestMethod = method[0];
	switch (requestMethod) {
		case GET:
			pathItem.setGet(operation);
			return;
		case PUT:
			pathItem.setPut(operation);
			return;
		case POST:
			pathItem.setPost(operation);
			return;
		case PATCH:
			pathItem.setPatch(operation);
			return;
		case HEAD:
			pathItem.setHead(operation);
			return;
		case OPTIONS:
			pathItem.setOptions(operation);
			return;
		case DELETE:
			pathItem.setDelete(operation);
			return;
		case TRACE:
			pathItem.setTrace(operation);
	}
}
 
Example 2
Source File: SwaggerConverter.java    From swagger-parser with Apache License 2.0 4 votes vote down vote up
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;
}