raml

Appending type data inline


In my use case I have a RAML 1.0 library created by our R&D department that contains definition of multiple data types. Those data types are defined in a generic, parametrized manner so when I reference them in my RAML I do so using following syntax:

type: { resourceTypes.collectionWithCriteria: {itemName: reward, itemCriteria: types.RewardCriteria, itemType : types.RewardList} }

This generates proper GET request with query string defined by types.RewardCriteria and response defined by types.RewardList. It also generates the description for the GET resource defined as: Retrieves the list of <<itemName | !pluralize>>, which ends up being Retrieves the list of rewards.

In my RAML I would like to append additional description to my GET resource, however I 'd rather avoid overwriting library-generated one. Is that possible? I've already tried inline description and using overlay file, both of which simply replace description from the library.


Solution

  • You cannot append for a single value simple property.

    The merging rules for traits / resource types state that the description will be replaced:

    Every explicit node wins over the ones that are declared in a resource type or trait. The rest are simply merged.

    Also, the merging rules of overlays and extensions states that:.

    If the property is a Simple Property
    If the property is a Single-value Simple Property, The property value in the identically named Current Target Tree Object property is replaced with its value from Current Extension Tree Object property.