File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -587,10 +587,10 @@ function buildArray (context, location) {
587587 functionCode += `
588588 if (${ i } < arrayLength) {
589589 if (${ buildArrayTypeCondition ( item . type , value ) } ) {
590- ${ tmpRes }
591- if (${ i } < arrayEnd) {
590+ if (${ i } ) {
592591 json += JSON_STR_COMMA
593592 }
593+ ${ tmpRes }
594594 } else {
595595 throw new Error(\`Item at ${ i } does not match schema definition.\`)
596596 }
@@ -601,21 +601,21 @@ function buildArray (context, location) {
601601 if ( schema . additionalItems ) {
602602 functionCode += `
603603 for (let i = ${ itemsSchema . length } ; i < arrayLength; i++) {
604- json += JSON.stringify(obj[i])
605- if (i < arrayEnd) {
604+ if (i) {
606605 json += JSON_STR_COMMA
607606 }
607+ json += JSON.stringify(obj[i])
608608 }`
609609 }
610610 } else {
611611 const code = buildValue ( context , itemsLocation , 'value' )
612612 functionCode += `
613613 for (let i = 0; i < arrayLength; i++) {
614- const value = obj[i]
615- ${ code }
616- if (i < arrayEnd) {
614+ if (i) {
617615 json += JSON_STR_COMMA
618616 }
617+ const value = obj[i]
618+ ${ code }
619619 }`
620620 }
621621
You can’t perform that action at this time.
0 commit comments