Browse Source

Merge pull request #15444 from dashevchenko/swaggerConfUpdate2

Updated SwaggerConfiguration to be in sync with pe
pull/15443/head
Viacheslav Klimov 6 months ago
committed by GitHub
parent
commit
d85f52a03e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 16
      application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java

16
application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java

@ -600,6 +600,22 @@ public class SwaggerConfiguration {
if (baseType != null) { if (baseType != null) {
return baseType; return baseType;
} }
// Check if other oneOf items extend this candidate via allOf (parent-child without discriminator)
if (candidate != null) {
boolean isParent = oneOfSchemas.stream()
.filter(s -> s.get$ref() != null && !s.get$ref().equals(ref))
.anyMatch(s -> {
String otherName = s.get$ref().substring(s.get$ref().lastIndexOf('/') + 1);
Schema<?> otherSchema = schemas.get(otherName);
return otherSchema != null && otherSchema.getAllOf() != null &&
otherSchema.getAllOf().stream().anyMatch(
a -> a.get$ref() != null && a.get$ref().endsWith("/" + refName));
});
if (isParent) {
return refName;
}
}
} }
return null; return null;
} }

Loading…
Cancel
Save