我有一个环回模型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请求以仅使用名称创建包时,它可以工作,但是如果我发送
{ 名称:“ test”, 产品:[] }
我有The pack instance is not valid. Details: products is not defined in the model (value: undefined).
答案 0 :(得分:0)
需要添加ones= np.ones(3, dtype=bool) #array([True, True, True])
zeros= np.zeros(5-3, dtype=bool) #array([False, False])
arr=np.concatenate((ones,zeros), axis=0, out=None) #arr - array([ True, True, True, False, False])
np.random.shuffle(arr) # now arr - array([False, True, True, True, False])
model-config.json
在"packProduct": {
"dataSource": "transient",
"public": false
}
datasources.json