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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
16 additions and
0 deletions
-
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; |
|
|
} |
|
|
} |
|
|
|