How to define a global variable in RAML

736 Views Asked by At

I want to use a global variable in RAML file:

#%RAML 1.0

title: MyTitle
myVariable: http://example.com
version: v1
baseUri: {myVariable}/{version}

but it doesn't work. Does RAML actually allow that?

1

There are 1 best solutions below

0
On BEST ANSWER

No, it doesn't allow to level vars like that. However it does allow you to define baseUriParameters like so:

#%RAML 1.0
---

baseUri: http://{myVariable}.com
baseUriParameters:
  myVariable:
    type: string
    enum: [ us-east, us-west, emea, apac ]
    default: us-east