-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data for an asset can be any valid json object, not necessarily a Map<String,String> currently. #36
Comments
Yes. I've been thinking about this as well. The simplest solution I was thinking is just to set a "String" type Asset. This way, it can be any json string format value. The developers would need to then create a model of their own and just deserialize it with GSON as well. so in the builder:
Introduce a new Asset Type object that accepts String only
This is the simplest way to approach it I think. |
Alvin I'd like to take this on, I think it be best if we could allow arbitrary objects to be used and not force users of the api to convert to String before setting. |
@agwego sure. just submit the PR and we'll review. Thank you. |
Some new information has come to light, and although Asset.data and metadata can be JsonObject it would appear that the transaction spec will be changing in the future to only allow leaf node types of: String, Boolean, null. array [], object {}. Which means, all other types like BigDecimal, Integer will have to be stringified. Sigh, JSON was a poor choice for a data transport. See: |
I actually have the generic code working for meta-data, i.e. any suitable JSONObject. Which I'll leave as is since it actually adheres to the specification as currently written. This is a pretty big change. |
Reading the BigchainDB specs data for an asset can be any valid JSON object. To that end BlockApiTest and AssetsApiTest are failing because of data elements like the following:
'''
"data": {
"CV": {
"FirstName": "John",
"LastName": "Doe"
}
},
"id": "dd67b1fb2ca4ef6649e174b602e5d92a3844b07d3f4027683a60a6efe73cbfe5"
'''
See "Asset" from the BigchainDB docs: https://docs.bigchaindb.com/projects/server/en/latest/schema/transaction.html#asset
I may try and tackle this.
The text was updated successfully, but these errors were encountered: