fix(sample-gen): generate the correct number of properties (#7432)

This commit fixes correct number of additionalProperties when minProperties is used.
This commit is contained in:
Helen Kosova
2021-09-15 15:54:26 +03:00
committed by GitHub
parent cc700f034b
commit f1aab53dd6
2 changed files with 33 additions and 2 deletions

View File

@@ -480,8 +480,8 @@ export const sampleFromSchemaGeneric = (schema, config={}, exampleOverride = und
} else {
const toGenerateCount = schema.minProperties !== null && schema.minProperties !== undefined && propertyAddedCounter < schema.minProperties
? schema.minProperties - propertyAddedCounter
: 4
for (let i = 1; i < toGenerateCount; i++) {
: 3
for (let i = 1; i <= toGenerateCount; i++) {
if(hasExceededMaxProperties()) {
return res
}