Importing RAML traits


#1

Hello everyone. I have a raml traits file located in ./data/traits/traits.raml (relative to the position of a.raml) and an a.raml (which should include traits.raml). I am using RAML 1.0. How can I import raml trait in my a.raml file ? - Traits file looks like this:

traits:
  paged:
     queryParameters:
  ordered:
     queryParameters:

Additionally I am using the traits in a.raml like this: is: [paged, ordered].


#2

What’s the content of your traits.raml file?


#3

Hi @mtanevski
Below is the reference for your query. like this we can import the traits into the raml. If am wrong please let me know.

traits:
secured: !include traits/secured.raml
rateLimited: !include traits/rate-limited.raml


#4

Here are the contents of my traits.raml file:

  traits:
      paged:
         queryParameters:
           f:
            type: integer
            required: false
            example: 10
            default: 0
           s:
             type: integer
             required: false
             example: 8
             default: 1
      ordered:
         queryParameters:
             o:
                type: string
                required: false

#5

I resolved my problem with:

uses:
   someTraits: data/traits/traits.raml

and then
is: [someTraits.paged, someTraits.ordered]