fix(openapi): fix lookupAspectSpec (#10478)

This commit is contained in:
david-leifker 2024-05-09 17:20:03 -05:00 committed by GitHub
parent fe33ce7ce6
commit de01634815
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -768,11 +768,11 @@ public class EntityController {
* @return
*/
private static AspectSpec lookupAspectSpec(EntitySpec entitySpec, String aspectName) {
return Optional.ofNullable(entitySpec.getAspectSpec(aspectName))
.orElse(
entitySpec.getAspectSpecs().stream()
.filter(aspec -> aspec.getName().toLowerCase().equals(aspectName))
.findFirst()
.get());
return entitySpec.getAspectSpec(aspectName) != null
? entitySpec.getAspectSpec(aspectName)
: entitySpec.getAspectSpecs().stream()
.filter(aspec -> aspec.getName().toLowerCase().equals(aspectName))
.findFirst()
.get();
}
}