Skip to main content

Construct Data

info

Please note that this content is under development and is not ready for implementation. This status message will be updated as content development progresses.

Description

The constructData object defines the schema for constructing event data, including field mappings, default values, and data generation rules. It is used in the Json Form component and is used when data needs to be mapped from one credential to another.

For example, when values from a DPP need to be mapped to properties within a transaction event or transformation event credential.

Example

{
"mappingFields": [
{
"sourcePath": "/vc/credentialSubject/productIdentifier/0/identifierValue",
"destinationPath": "/eventID"
},
{
"sourcePath": "/vc/credentialSubject/productIdentifier/0/identifierValue",
"destinationPath": "/epcList/index/name"
},
{
"sourcePath": "/linkResolver",
"destinationPath": "/epcList/index/itemID"
}
],
"dummyFields": [
{
"path": "/action",
"data": "observe"
},
{
"path": "/disposition",
"data": "https://ref.gs1.org/cbv/Disp/in_transit"
},
{
"path": "/bizStep",
"data": "https://ref.gs1.org/cbv/BizStep/receiving"
},
{
"path": "/bizLocation",
"data": "https://example.com/warehouse"
},
{
"path": "/sourceParty",
"data": {
"id": "did:web:api.acrs.pyx.io:top-line-steel",
"name": "Top Line Steel",
"identifiers": [
{
"scheme": "https://example.com/scheme/source",
"identifierValue": "SRC123456",
"binding": {
"type": "w3c_vc",
"assuranceLevel": "3rdParty",
"reference": "https://example.com/source_evidence"
}
}
]
}
},
{
"path": "/destinationParty",
"data": {
"id": "did:web:api.acrs.pyx.io:steel-processor",
"name": "Steel Processor",
"identifiers": [
{
"scheme": "https://example.com/scheme/destination",
"identifierValue": "DST7891011",
"binding": {
"type": "w3c_vc",
"assuranceLevel": "3rdParty",
"reference": "https://example.com/destination_evidence"
}
}
]
}
}
],
"generationFields": [
{
"path": "/eventID",
"handler": "generateIdWithSerialNumber"
},
{
"path": "/eventTime",
"handler": "generateCurrentDatetime"
}
]
}

Definitions

PropertyRequiredDescriptionType
mappingFieldsNoAn array of objects that define how data should be mapped from source paths to destination pathsMappingFields[]
dummyFieldsNoAn array of objects that specify default values for certain fields in the event dataDummyFields[]
generationFieldsNoAn array of objects that define fields whose values should be dynamically generatedGenerationFields[]

mappingFields

PropertyRequiredDescriptionType
sourcePathYesThe path in the source data where the value should be taken fromString
destinationPathYesThe path in the destination data where the value should be placedString

dummyFields

PropertyRequiredDescriptionType
pathYesThe path in the event data where the default value should be setString
dataYesThe default value to be set at the specified pathAny

generationFields

PropertyRequiredDescriptionType
pathYesThe path in the event data where the generated value should be setString
handlerYesThe name of the function or method that should be used to generate the valueHandler

This structure allows for flexible data construction by mapping existing data, providing default values, and generating dynamic data as needed for the event.

The mappingFields define how data is transferred from source to destination, dummyFields set default values, and generationFields specify which fields should have their values dynamically generated using specific handler functions.