I’m trying to initialize a realm with a schema which contain embedded Objects, but I always get Exception error
Error: Exception in HostFunction: Schema validation failed due to the following errors:
- Property 'Permits.other_passangers' of type 'array' has unknown object type 'permit_other_passangers'
- Property 'Permits.quantity' of type 'array' has unknown object type 'permit_quantity'
here is my schema file:
const PermitSchema = {
name: 'Permits',
properties: {
_id: 'objectId?',
__v: 'int?',
_partition: 'string',
cargo_type: 'string?',
location: 'string?',
other_passangers: {type: 'list', objectType: 'permit_other_passangers'},
quantity: {type: 'list', objectType: 'permit_quantity'},
where_to: 'string?',
updatedAt: 'date?',
},
primaryKey: '_id',
};
const permit_other_passangersSchema = {
name: 'permit_other_passangers',
embedded: true,
properties: {
name: 'string?',
phone: 'string?',
},
};
const permit_quantitySchema = {
name: 'permit_quantity',
embedded: true,
properties: {
amount: 'int?',
unit: {type: 'string?', enum: ['ndoo', 'djaba', 'pieces', 'gunia']},
},
};
export default PermitSchema;
I’ve tried to follow the docs here but I can’t find a work around, though removing those fields seems to fix the problem.
I will appreciate any help to point me in the right direction.