Building a simple hyperledger-composer based app and using model definitions similar to those in the vehicle-lifecycle sample code. Specifically, I have two model files: base.cto
namespace composer.base
abstract participant Member {
o String companyName
}
and sample.cto (partial listing)
namespace org.acme.Z2BTestNetwork
import composer.base.*
import composer.events.*
participant Buyer identified by buyerID extends Member{
o String buyerID
}
participant Seller identified by sellerID extends Member{
o String sellerID
}
asset Order identified by orderNumber {
o String orderNumber
o String[] items
I am able to successfully build the network using this structure and test the network, both using the composer-rest-server service and the Bluemix based composer. However a yo-generated app is unable to find "Member", apparently not importing the base.cto file during the generate and build process. yo generates a .ts file for each of the files in the model folder for this network. The .ts file which corresponds to 'sample.cto' contains the following, however it is missing the abstract definition from the base.cto file (which is in a different .ts file) and it is missing any link to that file.
import {Asset} from './org.hyperledger.composer.system';
import {Participant} from './org.hyperledger.composer.system';
import {Transaction} from './org.hyperledger.composer.system';
import {Event} from './org.hyperledger.composer.system';
// export namespace org.acme.Z2BTestNetwork{
export class Buyer extends Member {
buyerID: string;
}
export class Seller extends Member {
sellerID: string;
}
export class Shipper extends Member {
shipperID: string;
}
export class Provider extends Member {
providerID: string;
}
export class FinanceCo extends Member {
financeCoID: string;
}
export class Order extends Asset {
orderNumber: string;
items: string[];
An additional import statement is required for this app to function correctly.
import {Member} from './org.acme.Z2BTestNetwork.base';
This appears to be a bug in this implementation of yo for hyperledger-composer. Any recommendations on automating a fix for this?
Note if the yo option to use namespaces is selected, then only a single file is generated from sample.cto. The base.cto file no longer causes a .ts file to be generated; however the definitions from the base.cto file are not used and the app still fails to load because of the missing abstract definition for Member defined in the base.cto file.