Skip to content

Commit

Permalink
[FIX][CLI] handle null result messages (#7472)
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 #7453
  • Loading branch information
codymikol committed Sep 29, 2020
1 parent f7570df commit 6db283c
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 6db283c

Please sign in to comment.