Decorators in Hyperledger Composer Modeling Language

0 votes

I need an asset that would be defined dynamically with N amount of properties which aren't known at this moment and would be defined by the end user.

I assume that this could be done by using decorators in the modeling language, but I didn't find any examples that fully explains how to use them including Front-End interaction.

To be more clear I need an advice on how is it possible to implement something like this as a result:

asset $CustomNameFromFrontEnd {
o String id
o $TypeFromFrontEnd1 $PropertyNameFromFrontEnd1
o $TypeFromFrontEnd2 $PropertyNameFromFrontEnd2
…
o $TypeFromFrontEndN $PropertyNameFromFrontEndN
}
Sep 19, 2018 in Blockchain by digger
• 27,640 points
122 views

1 answer to this question.

0 votes

Define you CustomAsset like mentioned below and you should have no problem:

enum FieldType {
 o String
 o Double
 o Boolean
 o Integer
 o DateTime
 o Long
}

concept customFieldName {
 o String customFieldName
}

concept customFieldValue {
 o FieldType customFieldValue
}

concept customField {
 o customFieldName customFieldName
 o customFieldValue customFieldValue
}

asset CustomAsset identified by id {
 o String id
 o String assetName
 o customField[] customFields
}

transaction CreateCustomAsset {
 o CustomAsset customAsset
}
answered Sep 19, 2018 by slayer
• 29,050 points

Related Questions In Blockchain

0 votes
1 answer

How to solve EACCES:permission denied error in Hyperledger Composer?

It seems like there is no required ...READ MORE

answered Jul 11, 2018 in Blockchain by digger
• 27,640 points
358 views
0 votes
1 answer
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 27,640 points
67 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
138 views
0 votes
1 answer

Can i use HTTP GET to call external service in Hyperledger Composer?

Right now, the Hyperledger Composer supports only ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,050 points
41 views
0 votes
1 answer

How to solve "error trying install composer runtime" in Hyperledger composer?

I think the docker-compose tool is not ...READ MORE

answered Jul 17, 2018 in Blockchain by slayer
• 29,050 points
79 views