Resource Config
It provides additional details about the resource.
Possible Locations
Child Elements
- Path Config required
The <path-config> at the <content> level is given higher priority, allowing the configuration of different data extraction paths for various content. Conversely, the path config declared at the resource config level is generic and will be applied to all contents, receiving the lowest priority.
Attributes
Name | Type | Description |
---|---|---|
primary-type | String (enum) | The possible values are simple and composite.
|
primary-structure | String | The ref-name of the <structure> that represents the resource. |
The primary structure of a resource should always be declared in the <components>, even if it is not used multiple times in the ZSPEC.
Example
Let us say that in the trips resource, we want to add additional information about the resource using resource-config. Here is a sample json of the structure that represents the resource,
copy{ { "trips": [ { "trip_name":"Spring Break - John Doe", "destination": "Bali", "start_time": "2023-11-13T17:30:00", "end_time": "2023-11-17T22:30:00", "no_of_days": 4 } ] }
A <structure> with the above set of properties that represent the resource is called the primary structure of trips resource. You should declare it in the <components> as shown here.
copy<components> <!-- primary structure of the trips resource --> <structure ref-name="trips" name="primary_structure"> <property name="trip_name" type="string"/> <property name="trip_id" type="long_string"/> <property name="destination" type="string"/> <property name="start_time" type="datetime"/> <property name="end_time" type="datetime"/> <property name="no_of_days" type="string"/> </structure> <!-- wrapper of the primary structure --> <structure ref-name="data" name="wrapper"> <property name="trips" type="collections"> <structure-ref name="trips" /> </property> </structure> </components>
Now, use the trip_id and trip_name as the primary keys for the resource and write the resource config as follows
copy<resource-config primary-type="simple" primary-structure="trips"> <path-config data-extraction-path="$.trips"> <primary path="$.trip_id" /> <primary path="$.trip_name" /> </path-config> </resource-config>
Last Updated 2025-05-30 16:54:59 +0530 +0530
Yes
No
Send your feedback to us