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 * @return
*/ */
private static AspectSpec lookupAspectSpec(EntitySpec entitySpec, String aspectName) { private static AspectSpec lookupAspectSpec(EntitySpec entitySpec, String aspectName) {
return Optional.ofNullable(entitySpec.getAspectSpec(aspectName)) return entitySpec.getAspectSpec(aspectName) != null
.orElse( ? entitySpec.getAspectSpec(aspectName)
entitySpec.getAspectSpecs().stream() : entitySpec.getAspectSpecs().stream()
.filter(aspec -> aspec.getName().toLowerCase().equals(aspectName)) .filter(aspec -> aspec.getName().toLowerCase().equals(aspectName))
.findFirst() .findFirst()
.get()); .get();
} }
} }