我的资产“AirPollution”中有一些概念,例如“CarbonMonoxide”。但是如果我在终端中调用rest-composer-server,它会给我一些错误:
这是我的代码段:
asset AirPollutionData identified by airPollutionDataId {
o String airPollutionDataId
o String location
o DateTime datetime
o TransferStatus status default="FOR_SALE"
o CO co
o NO2 no2
o O3 o3
o PM10 pm10
o PM25 pm25
o SO2 so2
--> Member owner
}
concept CO {
o String pollutant_description default="Carbon monoxide"
o String units default="ppb"
o Double concentration
}
concept NO2 {
o String pollutant_description default="Nitrogen dioxide"
o String units default="ppb"
o Double concentration
}
concept O3 {
o String pollutant_description default="Ozone"
o String units default="ppb"
o Double concentration
}
concept PM10 {
o String pollutant_description default="Inhalable particulate matter (<10µm)"
o String units default="ug/m3"
o Double concentration
}
concept PM25 {
o String pollutant_description default="Fine particulate matter (<2.5µm)"
o String units default="ug/m3"
o Double concentration
}
concept SO2 {
o String pollutant_description default="Sulfur dioxide"
o String units default="ug/m3"
o Double concentration
}
这里出了什么问题?在我原始的角度应用程序中,如果我想添加资产,我没有看到来自概念的默认值,例如污染物描述或单位。
这就是我的意思:default values gone
答案 0 :(得分:0)
它对我有用。请参阅下面创建的AirPollutionData
资产的屏幕截图。
Swagger消息只是忽略了Concepts(它们不是资源端点)。
您发布的模型有错误:
您在下面这两个缺少定义(我创建了这些示例,只是为了让它起作用):
concept TransferStatus {
o String id
}
participant Member identified by id {
o String id
}
{
"$class": "org.acme.trading.AirPollutionData",
"airPollutionDataId": "3941",
"location": "Labore nisi esse incididunt non.",
"datetime": "2018-03-05T16:59:23.239Z",
"status": {
"$class": "org.acme.trading.TransferStatus",
"id": "In aute."
},
"co": {
"$class": "org.acme.trading.CO",
"pollutant_description": "Carbon monoxide",
"units": "ppb",
"concentration": 248.394
},
"no2": {
"$class": "org.acme.trading.NO2",
"pollutant_description": "Nitrogen dioxide",
"units": "ppb",
"concentration": 50.636
},
"o3": {
"$class": "org.acme.trading.O3",
"pollutant_description": "Ozone",
"units": "ppb",
"concentration": 144.997
},
"pm10": {
"$class": "org.acme.trading.PM10",
"pollutant_description": "Inhalable particulate matter (<10µm)",
"units": "ug/m3",
"concentration": 0.595
},
"pm25": {
"$class": "org.acme.trading.PM25",
"pollutant_description": "Fine particulate matter (<2.5µm)",
"units": "ug/m3",
"concentration": 60.074
},
"so2": {
"$class": "org.acme.trading.SO2",
"pollutant_description": "Sulfur dioxide",
"units": "ug/m3",
"concentration": 189.644
},
"owner": "resource:org.acme.trading.Member#1"
}
至于在Angular生成的字段中没有显示的默认值 - 我会发现。默认情况下,Playground中提供了这些默认设置,但不确定骨架应用程序中是否提供了这些默认设置(确切地说它是什么,供开发人员使用)。当我对此有更多了解时,我会编辑这个。