我的模型如下
abstract concept Address {
o String street
o String zip
o String city
o String country
}
participant Actor identified by userId {
o String userId
o String firstName
o String name
o Address address
}
当我在作曲家休息服务器中POST一个新的Actor时,我收到以下错误
“无法在命名空间io.mydomain.myapp中实例化抽象类型地址”,
我在这里错过了什么?
抽象类型并不意味着实例化,因此难怪它无法创建。
阅读:https://hyperledger.github.io/composer/latest/reference/cto_language
特别是这个引用是有意义的:
可选的“抽象”声明,表示无法创建此类型。抽象资源可以作为其他类扩展的基础。抽象类的扩展不继承抽象状态。例如,永远不应创建上面定义的资产Vehicle,因为应该定义更多特定的资产类来扩展它。
考虑文档的概念子标题。
TL; DR:阅读文档。