Closed Breadkenty closed 2 years ago
{
$id: 'CompanyIdPair',
type: 'object',
properties: {
id: {
type: 'string',
pattern: '^\\d+$',
errorMessage: { pattern: "\${1/id} is an invalid \${0#}, must be a numeric string." },
},
externalId: { type: 'string', errorMessage: {
type: "\${1/id} is an invalid \${0#}, must be a string."
} },
},
required: ['id', 'externalId'],
additionalProperties: false,
};
This fixed it for me
Hi,
I have the following JSON that I am trying to validate:
I want the validator to throw an error for the
id
property on the values with2a
and3b
. This is my model and the schema I am using:When I try to validate the schema and display the errors received with the following code
I keep getting the errors:
Instead of:
Any solution to this would be fantastic, thanks!