Mapping Backend Schema to Frontend Data Model
Conscia's Schema Mapping Components allow you to restructure and/or merge the data from your backend sources into a data model that your applications can more easily consume. It involves identifying the data elements in the source systems and specifying how they should be transformed and mapped to the corresponding data elements in the target system(s).
Here is an example of what the Schema Mapping Components can be used for:
Mapping Component Types
Conscia provides the following Schema Mapping Components which allow you to specify the target structure and how the target structure's elements are populated by the various sources:
Component Type | Description |
---|---|
Object Mapper | The Object Mapper works with the selected response object and allows you to remap the fields within the response. The configuration allows you to define a target structure using a drag and drop interface and specify evaluation expressions as values for each JSON property. These expressions are either query or script notations that operate on the source data that is provided as part of the component configuration. |
Property Mapper | The Property Mapper works with the selected response object and allows you to remap the fields within the response. The configuration allows you to define target properties and specify evaluation expressions as values for each JSON property. These expressions are either query or script notations that operate on the source data that is provided as part of the component configuration. |
Data Transformation Script | The Data Transformation Script works with a selected response object and allows you to use a complex JS script to select, map, and transform the data. |
Schema Mapper Components may be chained together (like any other Component) for complex transformations.
Source Expressions
JMESPath
JMESPath is an extremely flexible query language for JSON and its usage is described in detail on their website.
JSONPath
The JSONPath is another query language for JSON and is described here and here.
JSONata
JSONata allows for anything from simple JSON querying to more complicated scripting logic and is described here.
Conscia Javascript Expressions
A Javascript Expression allows for one JS expression that has access to the following variables and functions:
Variable/Function | Description |
---|---|
_ | Lodash utility |
encodeURI | Native Javascript function |
encodeURIComponent | Native Javascript function |
JSON | Native Javascript Object |
Array | Native Javascript Object |
Promise | Native Javascript Object |
Object | Native Javascript Object |
DateTime | Date and Time manipulation utility from the luxon library |
contextField(contextField) | This function returns the value of the specified Context Field. By using this function anywhere in a Component's configuration, the Component will not execute until after any other Components (that populate the specified Context Field) have run. |
componentResponse(componentCode) | This function returns the response from the specified Component. By using this function anywhere in a Component's configuration, the Component will not execute until after the specified Component has completed. |
componentStatus(componentCode) | This function returns the status of the specified Component. By using this function anywhere in a Component's configuration, the Component will not execute until after the specified Component has completed. |
componentExtras(componentCode) | This function returns properties in a Components @extras section, including metadata and triggered rules. By using this function anywhere in a Component's configuration, the Component will not execute until after the specified Component has completed. |