Skip to content

Commit

Permalink
ref #6394 - limit to 10 examples for array types
Browse files Browse the repository at this point in the history
  • Loading branch information
frantuma committed Jul 9, 2019
1 parent 74d9afe commit 8eacedc
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ private Object resolvePropertyToExample(String propertyName, String mediaType, S
Schema innerType = ((ArraySchema) property).getItems();
if (innerType != null) {
int arrayLength = null == ((ArraySchema) property).getMaxItems() ? 2 : ((ArraySchema) 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 8eacedc

Please sign in to comment.