Ajv: Array Validation stops on first element

Created on 16 Mar 2018  路  1Comment  路  Source: ajv-validator/ajv

my schema:

creditAccounts: {
                type: 'array',
                items: [ {
                    type: 'object',
                    properties: {
                        recordType: {
                            type: 'number',
                            const: 3,
                        },
                        beneficiaryAccountNumber: {type: 'string'},
                        beneficiarySortCode: {type: 'string'},
                        paymentDate: {type: 'string'},
                        paymentCurrency: {type: 'string'},
                        paymentAmount: {type: 'number'},
                        beneficiaryName: {type: 'string'},
                        paymentReference: {type: 'string'},
                        dealerId: {type: 'string'},
                        dealerRate: {type: 'number'},
                    },
                    required: ['recordType', 'beneficiaryAccountNumber', 'beneficiarySortCode', 'paymentDate', 'paymentCurrency'],
                }]

when I validate,.it fails for the first element in my array but not the others which have the same error.

OK

>All comments

Your schema is only supposed to validate first item - please see the JSON schema spec

Was this page helpful?
0 / 5 - 0 ratings