use of io.swagger.reader.SwaggerReader in project swagger-parser by swagger-api.
the class SwaggerLegacyParser method read.
public ApiDeclaration read(String url, String resourcePath, Authentication authentication) {
MessageBuilder messageBuilder = new MessageBuilder();
SwaggerReader swaggerReader = new SwaggerReaderFactory(new SwaggerReaderConfiguration()).newReader();
JsonNode jsonNode = null;
try {
String resourceListingURL = getResourceListingURL(url, resourcePath);
jsonNode = swaggerReader.read(resourceListingURL, authentication, messageBuilder);
} catch (URISyntaxException e) {
messageBuilder.append(new Message("", e.getMessage(), Severity.ERROR));
}
validateMessageReport(messageBuilder);
ApiDeclarationMigrator apiDeclarationMigrator = new ApiDeclarationMigrator();
jsonNode = apiDeclarationMigrator.migrate(messageBuilder, jsonNode);
validateMessageReport(messageBuilder);
ApiDeclarationJsonValidator apiDeclarationJsonValidator = new ApiDeclarationJsonValidator();
apiDeclarationJsonValidator.validate(messageBuilder, jsonNode);
validateMessageReport(messageBuilder);
ApiDeclarationDeserializer apiDeclarationDeserializer = new ApiDeclarationDeserializer();
ApiDeclaration apiDeclaration = apiDeclarationDeserializer.deserialize(jsonNode, messageBuilder);
validateMessageReport(messageBuilder);
return apiDeclaration;
}
Aggregations