Browse Source

updated SwaggerConfiguration to be in sync with pe

pull/15444/head
dashevchenko 6 months ago
parent
commit
3844945623
  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) {
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;
}

Loading…
Cancel
Save