Java Code Examples for io.swagger.v3.oas.models.Components#getRequestBodies()

The following examples show how to use io.swagger.v3.oas.models.Components#getRequestBodies() . 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: RefPointer.java    From openapi-diff with Apache License 2.0 6 votes vote down vote up
private Map<String, T> getMap(Components components) {
  switch (refType) {
    case REQUEST_BODIES:
      return (Map<String, T>) components.getRequestBodies();
    case RESPONSES:
      return (Map<String, T>) components.getResponses();
    case PARAMETERS:
      return (Map<String, T>) components.getParameters();
    case SCHEMAS:
      return (Map<String, T>) components.getSchemas();
    case HEADERS:
      return (Map<String, T>) components.getHeaders();
    case SECURITY_SCHEMES:
      return (Map<String, T>) components.getSecuritySchemes();
    default:
      throw new IllegalArgumentException("Not mapped for refType: " + refType);
  }
}
 
Example 2
Source File: ComponentsRequestBodiesKeysValidator.java    From servicecomb-toolkit with Apache License 2.0 4 votes vote down vote up
@Override
protected Map<String, ?> getMapProperty(Components components) {
  return components.getRequestBodies();
}
 
Example 3
Source File: ComponentsRequestBodiesValuesValidator.java    From servicecomb-toolkit with Apache License 2.0 4 votes vote down vote up
@Override
protected Map<String, RequestBody> getMapProperty(Components components) {
  return components.getRequestBodies();
}
 
Example 4
Source File: ComponentsRequestBodiesDiffValidator.java    From servicecomb-toolkit with Apache License 2.0 4 votes vote down vote up
@Override
protected Map<String, RequestBody> getMapProperty(Components oasObject) {
  return oasObject.getRequestBodies();
}
 
Example 5
Source File: ResolverFully.java    From swagger-parser with Apache License 2.0 4 votes vote down vote up
public void resolveFully(OpenAPI openAPI) {
    Components components = openAPI.getComponents();
    if (components != null && components.getRequestBodies() != null) {
        requestBodies = components.getRequestBodies();
        if (requestBodies == null) {
            requestBodies = new HashMap<>();
        }
    }

    if (components != null && components.getSchemas() != null) {
        schemas = components.getSchemas();
        if (schemas == null) {
            schemas = new HashMap<>();
        }
    }

    if (components != null && components.getExamples() != null) {
        examples = components.getExamples();
        if (examples == null) {
            examples = new HashMap<>();
        }
    }

    if (components != null && components.getHeaders() != null) {
        headers = components.getHeaders();
        if (headers == null) {
            headers = new HashMap<>();
        }
    }  

    if (components != null && components.getParameters() != null) {
        parameters = components.getParameters();
        if (parameters == null) {
            parameters = new HashMap<>();
        }
    }
    if (components != null && components.getLinks() != null) {
        links = components.getLinks();
        if (links == null) {
            links = new HashMap<>();
        }
    }
    Paths paths = openAPI.getPaths();
    if(paths != null) {
        for (String pathname : paths.keySet()) {
            PathItem pathItem = paths.get(pathname);
            resolvePath(pathItem);
        }
    }
}