3

When defining a trait in RAML it's possible to parameterize it, e.g.

traits:
  - searchable:
      queryParameters:
        query:
          description: Blah blah
          example: <<example>>

Has an <<example>> parameter which is provided by a resource that has this trait like so:

is: [searchable: {example: "exampleValue"}]

Is it possible to specify a default value for trait parameters, such that a resource that has the default value can omit the parameter?

ivanhoe
  • 111
  • 1
  • 7

2 Answers2

1

Just adding the default key should perform what you need:

traits:
  - searchable:
      queryParameters:
        query:
          description: Blah blah
          example: <<example>>
          default: "default value"
Karl Laird
  • 13
  • 5
0

Following your example, You could add a default key:

   query:
     description: Blah blah
     example: <<example>>
     default: value