Skip to content

Commit

Permalink
Merge pull request swagger-api#921 from swagger-api/swos-260
Browse files Browse the repository at this point in the history
fixed out of mem error on maxItems.
  • Loading branch information
HugoMario authored Jun 12, 2021
2 parents c17af4b + 0fe5ad9 commit 1387c00
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ private Object resolveSchemaToExample(String propertyName, String mediaType, Sch
Schema innerType = ((ArraySchema) schema).getItems();
if (innerType != null) {
int arrayLength = schema.getMaxItems() != null ? schema.getMaxItems() : 2;
if (arrayLength > 10) {
logger.warn("value of maxItems of property {} is {}; limiting to 10 examples", schema, arrayLength);
arrayLength = 10;
}
Object[] objectProperties = new Object[arrayLength];
Object objProperty = resolveSchemaToExample(propertyName, mediaType, innerType, processedModels);
for(int i=0; i < arrayLength; i++) {
Expand Down

0 comments on commit 1387c00

Please sign in to comment.