我正在用Hyperledger开发一个区块链应用程序。这是我的模型的一部分,即.cto文件:
concept Address{
o String addressId
o String PersonInChargeFullName
o String title
o String address1
o String address2 optional
o String city
o String country
o String zipcode regex=/^\d{5}$/
o String phone regex=/^\s*(?:\+?(\d{1,3}))?[-. (]*(\d{3})[-. )]*(\d{3})[-. ]*(\d{4})(?: *x(\d+))?\s*$/
o String email regex=/^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/
o Boolean isActive default=true
}
abstract participant Company identified by companyId{
o String companyId
o String companyName
o Address defaultAddress
}
participant OEM extends Company {
o Address[] plants
}从这个页面中,我了解到如果我们使用可选作为字段验证器,这意味着该字段是可选的,而其他字段则不是。我说的对吗?
尽管我没有将PersonInChargeFullName作为可选的,但是当我从提交数据(例如:"PersonInChargeFullName": "",)时,事务将被处理,没有任何错误。
请给我建议。
发布于 2019-06-25 05:41:00
这里的选项有一些不同的概念,尝试在没有PersonInChargeFullName字段的情况下运行代码,而不是以PersonInChargeFullName = ""的形式运行,但不要将它包含在json输入中,我很肯定您会得到错误。
https://stackoverflow.com/questions/52944552
复制相似问题