use of io.swagger.v3.oas.annotations.callbacks.Callback in project convertigo by convertigo.
the class OpenApiUtils method parse.
@SuppressWarnings("rawtypes")
public static OpenAPI parse(String requestUrl, Collection<UrlMapper> collection) {
OpenAPI openAPI = parseCommon(requestUrl, null);
List<Tag> tags = new ArrayList<>();
Components components = new Components();
components.callbacks(new HashMap<String, Callback>());
components.examples(new HashMap<String, Example>());
components.extensions(new HashMap<String, Object>());
components.headers(new HashMap<String, Header>());
components.links(new HashMap<String, Link>());
components.parameters(new HashMap<String, Parameter>());
components.requestBodies(new HashMap<String, RequestBody>());
components.responses(new HashMap<String, ApiResponse>());
components.schemas(new HashMap<String, Schema>());
components.securitySchemes(new HashMap<String, SecurityScheme>());
Paths paths = new Paths();
for (UrlMapper urlMapper : collection) {
if (urlMapper != null) {
OpenAPI _openAPI = parse(requestUrl, urlMapper);
if (_openAPI != null) {
try {
tags.addAll(_openAPI.getTags());
} catch (Exception e) {
}
try {
paths.putAll(_openAPI.getPaths());
} catch (Exception e) {
}
Components _components = _openAPI.getComponents();
if (_components != null) {
try {
components.getCallbacks().putAll(_components.getCallbacks());
} catch (Exception e) {
}
try {
components.getExamples().putAll(_components.getExamples());
} catch (Exception e) {
}
try {
components.getExtensions().putAll(_components.getExtensions());
} catch (Exception e) {
}
try {
components.getHeaders().putAll(_components.getHeaders());
} catch (Exception e) {
}
try {
components.getLinks().putAll(_components.getLinks());
} catch (Exception e) {
}
try {
components.getParameters().putAll(_components.getParameters());
} catch (Exception e) {
}
try {
components.getRequestBodies().putAll(_components.getRequestBodies());
} catch (Exception e) {
}
try {
components.getResponses().putAll(_components.getResponses());
} catch (Exception e) {
}
try {
components.getSchemas().putAll(_components.getSchemas());
} catch (Exception e) {
}
try {
components.getSecuritySchemes().putAll(_components.getSecuritySchemes());
} catch (Exception e) {
}
}
}
}
}
openAPI.setTags(tags);
openAPI.setPaths(paths);
openAPI.setComponents(components);
return openAPI;
}
Aggregations