You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I looked into fabric-chaincode-java. The constructor of DataTypeDefinitionImpl puts "guid" to this.properties. Then we execute JSONTransactionSerializer.toBuffer(). We will run final JSONObject obj = new JSONObject(new JSONObject(value), propNames); where propNames is ["guid"]. JSONObject outputs nothing in this situation.
It looks like to me that in order for field X to show up in the returned JSON, we have to 1. add @Property to field X; 2. make sure field X has a getter named getX.
Steps to reproduce
I'm looking at version 2.3 but I think the behavior holds for the lastest version.
The following code is based on https://github.com/hyperledger/fabric-samples/tree/main/asset-transfer-basic/chaincode-java.
Run the code on the test-network.
What I expect
When I call
I expect to see a non-empty output. The output might be
{guid:"1"}
or{PK:"1"}
, I don't know.Since I already used
@Property
to annotate a field, I do not expect to see an empty json, i.e.,{}
.What actually happened
Discussion
I looked into fabric-chaincode-java. The constructor of DataTypeDefinitionImpl puts "guid" to
this.properties
. Then we execute JSONTransactionSerializer.toBuffer(). We will runfinal JSONObject obj = new JSONObject(new JSONObject(value), propNames);
where propNames is["guid"]
. JSONObject outputs nothing in this situation.It looks like to me that in order for field X to show up in the returned JSON, we have to 1. add
@Property
to field X; 2. make sure field X has a getter namedgetX
.To prove if I change to
I get
Suggestion
I feel this issue could be a documentation oversight as
@Property
didn't mention getters. If maintainers like, I can add something likeThe text was updated successfully, but these errors were encountered: