I got a error when I write chaincode with "github.com/hyperledger/fabric-contract-api-go/contractapi"
type PaginatedQueryResult struct {
Records []asset `json:"records"`
FetchedRecordsCount int32 `json:"fetchedRecordsCount"`
Bookmark string `json:"bookmark"`
Completed bool `json:"completed"`
}
when the Record is nil, report error: " asset_transfer_ledger chaincode Value did not match schema:\n 1. return.records: Invalid type. Expected: array, given: null", then I update PaginatedQueryResult struct like that:
type PaginatedQueryResult struct {
Records []asset `json:"records,omitempty" metadata:",optional" `
FetchedRecordsCount int32 `json:"fetchedRecordsCount"`
Bookmark string `json:"bookmark"`
Completed bool `json:"completed"`
}
if Records is nil, this is ok, but when Record is not nil, get a error: "Additional property records is not allowed"