Extend Property
This element allows you to override or switch to different attribute values with respect to the parent <property> attributes.
Possible locations
- Except for the name attribute, extend-property can override all the attributes of the parent property.
- In extend-property, you can add all the attributes and child elements of a property, but not the name attribute.
- All the child elements and attributes are optional for extend-property.
- You can override the type attribute, only with the subtypes of the parent property’s datatype. For example, you can override the number type with integer or double.
Elemental Behavior:
You can not extend an extend-property further with another extend-property.
Example
Consider that in the trips resource, you want to customize the behavior of a particular <property> (adventure_activities) in <response>, depending upon an <argument> called service.
adventure_activities: Object datatype
automation service: adventure_activities key should be a 'collection'
All other services: adventure_activities key should behave as a 'Boolean'
Following is a sample of adventure_activities property behaving as a JSON array:
{
"adventure_activities": [
"Hiking",
"Rock Climbing",
"Wildlife Safaris",
"Surfing"
]
}
Now, write the extend-property as follows to configure this adventure_activities property as collections for automation service and Boolean for the rest.
<response name="get_success" status="200">
<content>
<encode type="application/json" />
<structure>
<property name="adventure_activities" type="object">
<extend-property type="collections" condition-for-response="'automation' :: REQUEST:$.params.service">
<structure>
<property type="string" />
</structure>
</extend-property>
<extend-property type="boolean" condition-for-response="REQUEST:$.params.service == null || REQUEST:$.params.service != automation" />
</property>
</structure>
</content>
</response>
Refer to the conditions and data path to learn more on how to construct conditions for the condition-for-response attribute used in this sample.
Last Updated 2025-05-30 16:54:59 +0530 IST
Yes
No
Send your feedback to us