[FIX][CLI] handle null result messages (#7472)

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
This commit is contained in:
Cody Mikol
2020-09-29 08:52:14 -04:00
committed by GitHub
parent f7570df5c3
commit 6db283c03b

View File

@@ -518,7 +518,7 @@ public class CodegenConfigurator {
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