Skip to content

Commit

Permalink
Fix spot bug issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TharmiganK committed Sep 19, 2024
1 parent bdbb2ec commit 5103a10
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -481,13 +481,12 @@ public static Optional<String> getBallerinaNameExtension(Parameter parameter) {
}

public static Optional<String> getBallerinaNameExtension(Schema schema) {
if (Objects.isNull(schema) || Objects.isNull(schema.getExtensions())) {
return Optional.empty();
}
return getBallerinaNameExtension(schema.getExtensions());
return Optional.ofNullable(schema)
.map(Schema::getExtensions)
.flatMap(GeneratorUtils::getBallerinaNameExtension);
}

public static Optional<String> getBallerinaNameExtension(Map extensions) {
public static Optional<String> getBallerinaNameExtension(Map<String, Object> extensions) {
return Optional.ofNullable(extensions)
.map(ext -> ext.get(X_BALLERINA_NAME))
.filter(String.class::isInstance)
Expand Down

0 comments on commit 5103a10

Please sign in to comment.