How to use variable in raml for response code?


#1

Currently In raml we have to hard-code the response code as below:
responses:
200:
description: O.K.
body:
application/json:
schema: xyz
example: abc

But my requirement is to use a variable in raml for my response code. Instead of 200 response code, I have declared a variable as below:

responses:
{someVariable}:
description: O.K.
body:
application/json:
schema: <>
example: <>

This variable can be read from any properties file or so.
Does raml support this? And how to implement this in raml


#2

Hi @gargmohit, can you please elaborate more on this? As far as I know there is no way to declare a variable and load it from a property file, but maybe if I understand your underlying problem - we could find a suitable solution.


#3

Even I feel the same .
RAML is an API specification and I am not sure if a variable can be populated in RAML from a .properties file and as far I know RAML doesn’t support this.


#4

I actually know people that used maven plugins, templatized the RAML document and substitute values during the compile time based on the active spring profile. something like that.