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,620 points
80 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,040 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,620 points
214 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,620 points
36 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
60 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,040 points
26 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,040 points
51 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.