Skip to content

Commit

Permalink
Fix logging errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TharmiganK committed Sep 10, 2024
1 parent 726e2a5 commit dd5a48e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions openapi-cli/src/main/java/io/ballerina/openapi/cmd/Flatten.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,16 @@ private Optional<OpenAPI> getFlattenOpenAPI(String openAPIFileContent) {
// Flattening will be done after filtering the operations
SwaggerParseResult parseResult = new OpenAPIParser().readContents(openAPIFileContent, null,
new ParseOptions());
if (!parseResult.getMessages().isEmpty()) {
if (parseResult.getMessages().contains(UNSUPPORTED_OPENAPI_VERSION_PARSER_MESSAGE)) {
errorStream.println(ERROR_UNSUPPORTED_OPENAPI_VERSION);
return Optional.empty();
}
if (!parseResult.getMessages().isEmpty() &&
parseResult.getMessages().contains(UNSUPPORTED_OPENAPI_VERSION_PARSER_MESSAGE)) {
errorStream.println(ERROR_UNSUPPORTED_OPENAPI_VERSION);
return Optional.empty();
}

OpenAPI openAPI = parseResult.getOpenAPI();
if (Objects.isNull(openAPI)) {
errorStream.println(ERROR_OCCURRED_WHILE_PARSING_THE_INPUT_OPENAPI_FILE);
if (Objects.nonNull(parseResult.getMessages())) {
if (!parseResult.getMessages().isEmpty()) {
errorStream.println(FOUND_PARSER_DIAGNOSTICS);
parseResult.getMessages().forEach(errorStream::println);
}
Expand Down

0 comments on commit dd5a48e

Please sign in to comment.