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

The following examples show how to use io.swagger.v3.oas.models.PathItem#getPatch() . 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: OperationBuilder.java    From springdoc-openapi with Apache License 2.0 6 votes vote down vote up
/**
 * Extract operation id from path item set.
 *
 * @param path the path
 * @return the set
 */
private Set<String> extractOperationIdFromPathItem(PathItem path) {
	Set<String> ids = new HashSet<>();
	if (path.getGet() != null && StringUtils.isNotBlank(path.getGet().getOperationId())) {
		ids.add(path.getGet().getOperationId());
	}
	if (path.getPost() != null && StringUtils.isNotBlank(path.getPost().getOperationId())) {
		ids.add(path.getPost().getOperationId());
	}
	if (path.getPut() != null && StringUtils.isNotBlank(path.getPut().getOperationId())) {
		ids.add(path.getPut().getOperationId());
	}
	if (path.getDelete() != null && StringUtils.isNotBlank(path.getDelete().getOperationId())) {
		ids.add(path.getDelete().getOperationId());
	}
	if (path.getOptions() != null && StringUtils.isNotBlank(path.getOptions().getOperationId())) {
		ids.add(path.getOptions().getOperationId());
	}
	if (path.getHead() != null && StringUtils.isNotBlank(path.getHead().getOperationId())) {
		ids.add(path.getHead().getOperationId());
	}
	if (path.getPatch() != null && StringUtils.isNotBlank(path.getPatch().getOperationId())) {
		ids.add(path.getPatch().getOperationId());
	}
	return ids;
}
 
Example 2
Source File: OperationHelper.java    From zap-extensions with Apache License 2.0 5 votes vote down vote up
public List<OperationModel> getAllOperations(PathItem path, String url) {
    List<OperationModel> operations = new LinkedList<OperationModel>();

    if (path.getGet() != null) {
        operations.add(new OperationModel(url, path.getGet(), RequestMethod.GET));
    }
    if (path.getPost() != null) {
        operations.add(new OperationModel(url, path.getPost(), RequestMethod.POST));
    }
    if (path.getPut() != null) {
        operations.add(new OperationModel(url, path.getPut(), RequestMethod.PUT));
    }
    if (path.getHead() != null) {
        operations.add(new OperationModel(url, path.getHead(), RequestMethod.HEAD));
    }
    if (path.getOptions() != null) {
        operations.add(new OperationModel(url, path.getOptions(), RequestMethod.OPTION));
    }
    if (path.getDelete() != null) {
        operations.add(new OperationModel(url, path.getDelete(), RequestMethod.DELETE));
    }
    if (path.getPatch() != null) {
        operations.add(new OperationModel(url, path.getPatch(), RequestMethod.PATCH));
    }
    if (operations.isEmpty()) {
        log.debug("Failed to find any operations for url=" + url + " path=" + path);
    }

    return operations;
}