Skip to content

Commit

Permalink
[FIX][CLI] handle null result messages
Browse files Browse the repository at this point in the history
swagger-parser has the potential to return null
for messages which will throw NPE on
initialization of the  validationMessages hashset.
rather that allow this to happen we will assume
that a null message collection represents an empty
collection and continue.

Fixes OpenAPITools#7453
  • Loading branch information
Cody Mikol committed Sep 21, 2020
1 parent 80bef2f commit 97f13d0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ public Context<?> toContext() {
SwaggerParseResult result = new OpenAPIParser().readLocation(inputSpec, authorizationValues, options);

// TODO: Move custom validations to a separate type as part of a "Workflow"
Set<String> validationMessages = new HashSet<>(result.getMessages());
Set<String> validationMessages = new HashSet<>(null != result.getMessages() ? result.getMessages() : new ArrayList<>());
OpenAPI specification = result.getOpenAPI();
// TODO: The line below could be removed when at least one of the issue below has been resolved.
// https://github.com/swagger-api/swagger-parser/issues/1369
Expand Down

0 comments on commit 97f13d0

Please sign in to comment.