RAML paramterized type

I need to extract and reuse a specific description field and parameterize it along different types.

types:
  Category:
    type: object
    properties:
      name: 
        type: object
        description: This is the description for field name
      handle:
        type: object
        handle: This is the description for field handle
      seo_description: 
        type: object
        desciption: This is the description for field seo_description

As you see all the descriptions are the same but it differs from the placeholder.

I’ve tried using resourceType as following:

resourceTypes:
  paramterizedDescription:
    type: object
    description: This is the description for <<field>>

ResourceTypes and Traits may be parametrized, what you’re trying to do however is to parametrize types. There is no way to do that. In a way, it forces the API spec author to write unique descriptions for each field/property. Not dismissing the need for something like this, simply putting things in perspective.

1 Like