Hyperledger Fabic 2.2.0错误处理成功响应.值与架构不符 [英] Hyperledger Fabic 2.2.0 Error handling success response. Value did not match schema
问题描述
我正在使用Hyperledger Fabric 2.2.0和Fabric-network 2.1(不是很重要).
I am using Hyperledger Fabric 2.2.0 and fabric-network 2.1 (not that important).
我的链码是用Go编写的.所以我有一些在JSON标签中具有,omitempty
的结构.这是我的结构:
My chaincode is written in Go. So I have some structs which have ,omitempty
in JSON tag. Here is my struct:
type LeaseDetails struct {
EndOfTerm string `json:"endOfTerm"`
Info string `json:"info,omitempty"`
Option string `json:"option,omitempty"`
}
但是我从链码中得到以下错误作为返回值:
But I am getting the following error as a return value from my chaincode:
peer=peer0.org1.example.com:7051, status=500, message=Error handling success response. Value did not match schema:
1. return.0.leaseDetails: info,omitempty is required
2. return.0.leaseDetails: option,omitempty is required
如果我从结构中删除,omitempty
,并提供默认值,则一切正常.
在fabric-contract-api-go
的文档中,提到在json marshal/unmarshal的基础上构建了某种序列化程序,但对我而言似乎没有检测到,omitempty
关键字.
If I remove ,omitempty
from my struct, and provide default value everything works fine.
In the docs for fabric-contract-api-go
it is mentioned that there is some kind of serializer built upon json marshal/unmarshal, but to me it doesn't seem to detect the ,omitempty
keyword.
这是故意的吗?还是我在这里想念东西?
Was this intentional? Or am I missing something here?
预先感谢