Skip to content

Commit 6db283c

Browse files
authored
[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
1 parent f7570df commit 6db283c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ public Context<?> toContext() {
518518
SwaggerParseResult result = new OpenAPIParser().readLocation(inputSpec, authorizationValues, options);
519519

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

0 commit comments

Comments
 (0)