use of io.gravitee.rest.api.service.impl.swagger.converter.api.OAIToAPIConverter in project gravitee-management-rest-api by gravitee-io.
the class SwaggerServiceImpl method createAPI.
@Override
public SwaggerApiEntity createAPI(ImportSwaggerDescriptorEntity swaggerDescriptor, DefinitionVersion definitionVersion) {
ParseOptions options = new ParseOptions();
// In the context of an import, we need to fully resolve $ref which are required for OAIDescriptorVisitors (ie. policies).
options.setResolveFully(true);
boolean wsdlImport = Format.WSDL.equals(swaggerDescriptor.getFormat());
SwaggerDescriptor descriptor = parse(swaggerDescriptor.getPayload(), wsdlImport, options);
if (wsdlImport) {
overridePayload(swaggerDescriptor, descriptor);
populateXmlToJsonPolicy(swaggerDescriptor);
}
if (descriptor != null) {
if (definitionVersion.equals(DefinitionVersion.V2)) {
return new OAIToAPIV2Converter(swaggerDescriptor, policyOperationVisitorManager, groupService, tagService).convert((OAIDescriptor) descriptor);
} else {
return new OAIToAPIConverter(swaggerDescriptor, policyOperationVisitorManager, groupService, tagService).convert((OAIDescriptor) descriptor);
}
}
throw new SwaggerDescriptorException();
}
Aggregations