Skip to content

Commit

Permalink
Merge pull request #9553 from swagger-api/swos-120
Browse files Browse the repository at this point in the history
ref #6394 - limit to 10 examples for array types
  • Loading branch information
frantuma authored Jul 9, 2019
2 parents e0904f6 + 80512fe commit 09effbd
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ private Object resolvePropertyToExample(String propertyName, String mediaType, P
Property innerType = ((ArrayProperty) property).getItems();
if (innerType != null) {
int arrayLength = null == ((ArrayProperty) property).getMaxItems() ? 2 : ((ArrayProperty) property).getMaxItems();
// max 10 examples to avoid OOM
if (arrayLength > 10) {
logger.warn("value of maxItems of property {} is {}; limiting to 10 examples", property, arrayLength);
arrayLength = 10;
}
Object[] objectProperties = new Object[arrayLength];
Object objProperty = resolvePropertyToExample(propertyName, mediaType, innerType, processedModels);
for(int i=0; i < arrayLength; i++) {
Expand Down

0 comments on commit 09effbd

Please sign in to comment.