Skip to content

Latest commit

 

History

History
28 lines (25 loc) · 525 Bytes

migrating-from-express-jsonschema.md

File metadata and controls

28 lines (25 loc) · 525 Bytes

Migrating from express-jsonschema

In express-jsonschema, you could define a required property in two ways. Ajv only supports one way of doing this:

// CORRECT
{
    type: 'object',
    properties: {
        foo: {
            type: 'string'
        }
    },
    required: ['foo'] // correct use of `required` keyword
}

// WRONG
{
    type: 'object',
    properties: {
        foo: {
            type: 'string',
            required: true // incorrect use of `required` keyword
        }
    }
}