balena-io-modules / reql-schema

ReQL to JSON Schema translator
Apache License 2.0
3 stars 0 forks source link

Schema parsing fails if value of "contains" is an object #2

Open LucianBuzzo opened 5 years ago

LucianBuzzo commented 5 years ago

If the value of contains is an object schema, then reql-schema will throw the error The "contains" schema must include "const".

Here is a call that will reproduce the error:

const cursor = await reqlSchema('myDb', 'myTable', {
    type: 'object',
    properties: {
        members: {
            type: 'array',
            contains: {
                type: 'object',
                properties: {
                    id: {
                        const: '1234-5678-9101'
                    }
                }
            }
        }
    }
}).run(connection)