Java Code Examples for org.eclipse.microprofile.openapi.models.PathItem#setPUT()

The following examples show how to use org.eclipse.microprofile.openapi.models.PathItem#setPUT() . 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: PathsReader.java    From smallrye-open-api with Apache License 2.0 6 votes vote down vote up
/**
 * Reads a {@link PathItem} OpenAPI node.
 * 
 * @param node json object
 * @return PathItem model
 */
public static PathItem readPathItem(final JsonNode node) {
    if (node == null || !node.isObject()) {
        return null;
    }
    IoLogging.log.singleJsonNode("PathItem");
    PathItem pathItem = new PathItemImpl();
    pathItem.setRef(JsonUtil.stringProperty(node, Referenceable.PROP_$REF));
    pathItem.setSummary(JsonUtil.stringProperty(node, PathsConstant.PROP_SUMMARY));
    pathItem.setDescription(JsonUtil.stringProperty(node, PathsConstant.PROP_DESCRIPTION));
    pathItem.setGET(OperationReader.readOperation(node.get(PathsConstant.PROP_GET)));
    pathItem.setPUT(OperationReader.readOperation(node.get(PathsConstant.PROP_PUT)));
    pathItem.setPOST(OperationReader.readOperation(node.get(PathsConstant.PROP_POST)));
    pathItem.setDELETE(OperationReader.readOperation(node.get(PathsConstant.PROP_DELETE)));
    pathItem.setOPTIONS(OperationReader.readOperation(node.get(PathsConstant.PROP_OPTIONS)));
    pathItem.setHEAD(OperationReader.readOperation(node.get(PathsConstant.PROP_HEAD)));
    pathItem.setPATCH(OperationReader.readOperation(node.get(PathsConstant.PROP_PATCH)));
    pathItem.setTRACE(OperationReader.readOperation(node.get(PathsConstant.PROP_TRACE)));
    pathItem.setParameters(ParameterReader.readParameterList(node.get(PathsConstant.PROP_PARAMETERS)).orElse(null));
    pathItem.setServers(ServerReader.readServers(node.get(PathsConstant.PROP_SERVERS)).orElse(null));
    ExtensionReader.readExtensions(node, pathItem);
    return pathItem;
}
 
Example 2
Source File: FilterUtil.java    From smallrye-open-api with Apache License 2.0 5 votes vote down vote up
/**
 * Filters the given model.
 * 
 * @param filter
 * @param model
 */
private static void filterPathItem(OASFilter filter, PathItem model) {
    if (model != null) {
        model.setParameters(filterParameterList(filter, model.getParameters()));
        filterOperation(filter, model.getDELETE());
        if (model.getDELETE() != null) {
            model.setDELETE(filter.filterOperation(model.getDELETE()));
        }
        filterOperation(filter, model.getGET());
        if (model.getGET() != null) {
            model.setGET(filter.filterOperation(model.getGET()));
        }
        filterOperation(filter, model.getHEAD());
        if (model.getHEAD() != null) {
            model.setHEAD(filter.filterOperation(model.getHEAD()));
        }
        filterOperation(filter, model.getOPTIONS());
        if (model.getOPTIONS() != null) {
            model.setOPTIONS(filter.filterOperation(model.getOPTIONS()));
        }
        filterOperation(filter, model.getPATCH());
        if (model.getPATCH() != null) {
            model.setPATCH(filter.filterOperation(model.getPATCH()));
        }
        filterOperation(filter, model.getPOST());
        if (model.getPOST() != null) {
            model.setPOST(filter.filterOperation(model.getPOST()));
        }
        filterOperation(filter, model.getPUT());
        if (model.getPUT() != null) {
            model.setPUT(filter.filterOperation(model.getPUT()));
        }
        filterOperation(filter, model.getTRACE());
        if (model.getTRACE() != null) {
            model.setTRACE(filter.filterOperation(model.getTRACE()));
        }
        filterServers(filter, model.getServers());
    }
}
 
Example 3
Source File: AnnotationScanner.java    From smallrye-open-api with Apache License 2.0 5 votes vote down vote up
/**
 * Set the created operation to the pathItem
 * 
 * @param methodType the HTTP method type
 * @param pathItem the pathItem to set
 * @param operation the operation
 */
default void setOperationOnPathItem(PathItem.HttpMethod methodType, PathItem pathItem, Operation operation) {
    switch (methodType) {
        case DELETE:
            pathItem.setDELETE(operation);
            break;
        case GET:
            pathItem.setGET(operation);
            break;
        case HEAD:
            pathItem.setHEAD(operation);
            break;
        case OPTIONS:
            pathItem.setOPTIONS(operation);
            break;
        case PATCH:
            pathItem.setPATCH(operation);
            break;
        case POST:
            pathItem.setPOST(operation);
            break;
        case PUT:
            pathItem.setPUT(operation);
            break;
        case TRACE:
            pathItem.setTRACE(operation);
            break;
        default:
            break;
    }
}