Композитор Hyperledger работает с использованием REST API на http://localhost:3000/explorer
Произошла ошибка при создании нового участника ученика. Благодаря -> Курс [] курсы
{имя = курсы, тип = com.pax.onlinecourse.Course, массив = true, необязательно = false}
Тело ответа:
{
"error": {
"statusCode": 500,
"name": "Error",
"message": "Invalid JSON data. Found a value that is not a string: [object Object] for relationship RelationshipDeclaration {name=courses, type=com.pax.onlinecourse.Course, array=true, optional=false}",
"stack": "Error: Invalid JSON data. Found a value that is not a string: [object Object] for relationship RelationshipDeclaration {name=courses, type=com.pax.onlinecourse.Course, array=true, optional=false}\n at JSONPopulator.visitRelationshipDeclaration (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/serializer/jsonpopulator.js:268:31)\n at JSONPopulator.visit (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/serializer/jsonpopulator.js:102:25)\n at RelationshipDeclaration.accept (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/introspect/decorated.js:65:24)\n at JSONPopulator.visitClassDeclaration (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/serializer/jsonpopulator.js:128:51)\n at JSONPopulator.visit (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/serializer/jsonpopulator.js:100:25)\n at ParticipantDeclaration.accept (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/introspect/decorated.js:65:24)\n at Serializer.fromJSON (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/serializer.js:203:26)\n at ensureConnected.then (/usr/local/lib/node_modules/composer-rest-server/node_modules/loopback-connector-composer/lib/businessnetworkconnector.js:635:43)\n at <anonymous>\n at process._tickCallback (internal/process/next_tick.js:118:7)"
}
}
Код ответа: 500
.cto Файл:
namespace com.pax.onlinecourse
abstract participant Person identified by emailId {
o String emailId
o String name
o Double balance default=1000.0
}
enum Education{
o SLC
o PLUS2
o BACHELORS
o MASTERS
}
participant Student extends Person {
o Education education
--> Course[] courses
}
participant Teacher extends Person{
o String[] skills
}
asset Course identified by courseId{
o String courseId
o String courseName
o Double amount
o Integer enrollNo default=0
--> Teacher teacher
}
transaction BuyCourse {
--> Student student
--> Course course
}
Эта ошибка не возникала при развертывании файла .bna на онлайн-площадке для композиторов.