У меня есть одна петлевая модель pack
{
"name": "pack",
"plural": "packs",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"name": {
"type": "string",
"required": true
},
"description1": {
"type": "string"
},
"description2": {
"type": "string"
}
},
"validations": [],
"relations": {
"products": {
"type": "embedsMany",
"model": "packProduct",
"property": "products",
"options": {
"validate": true,
"forceId": false
}
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$unauthenticated",
"permission": "DENY"
}
],
"methods": {},
"strict": true
}
Теперь packProduct
модель
{
"name": "packProduct",
"plural": "packProducts",
"base": "Model",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"productId": {
"type": "string",
"required": true
},
"price": {
"type": "number",
"required": true
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {},
"strict": true
}
Когда я отправляю POST-запрос на создание пакета только с именем, он работает, но если я отправляю
{
название: «тест»,
товары: []
}
У меня есть The pack instance is not valid. Details: products is not defined in the model (value: undefined).