我在模型文件中定义了一个概念。看起来像这样
concept DoctorSchedule {
o Boolean AM12to1 optional
o Boolean AM1to2 optional
o Boolean AM2to3 optional
o Boolean AM3to4 optional
o Boolean AM4to5 optional
o Boolean AM5to6 optional
o Boolean AM6to7 optional
o Boolean AM7to8 optional
o Boolean AM8to9 optional
o Boolean AM9to10 optional
o Boolean AM10to11 optional
o Boolean AM11to12 optional
o Boolean PM12to1 optional
}
participant Doctor identified by doctorID {
o String doctorID
o String contact
o DoctorSchedule doctorSchedule
}
当我在作曲家操场上测试时,尝试添加新的医生参与者。 JSON预览看起来像这样
{
"$class": "org.acme.Doctor",
"doctorID": "0624",
"contact": "",
"doctorSchedule": {
"$class": "org.acme.DoctorSchedule",
"AM12to1": false,
"AM1to2": false,
"AM2to3": false,
"AM3to4": false,
"AM4to5": false,
"AM5to6": false,
"AM6to7": false,
"AM7to8": false,
"AM8to9": false,
"AM9to10": false,
"AM10to11": false,
"AM11to12": false,
"PM12to1": false,
}}
但是当我生成composer-rest-server并尝试使用post方法添加医生时,会出现一个额外的id字段
{
"$class": "org.acme.Doctor",
"doctorID": "stri1ng",
"contact": "string",
"doctorSchedule": {
"$class": "org.acme.DoctorSchedule",
"AM12to1": true,
"AM1to2": true,
"AM2to3": true,
"AM3to4": true,
"AM4to5": true,
"AM5to6": true,
"AM6to7": true,
"AM7to8": true,
"AM8to9": true,
"AM9to10": true,
"AM10to11": true,
"AM11to12": true,
"PM12to1": true,
"id": "string"
}}
DoctorSchedule概念中的这个id字段是什么?根据我的理解,你不需要一个ID来识别一个概念(比如资产或参与者)。为什么这个id字段出现在composer-rest-server而不是composer-playground中?
注意:如果此id为空字符串,则post方法会抛出错误。