I am modelling an API with RAML and I am wondering if it’s possible to model dependencies between a query parameters.
Let’s say we’ve got a collection of objects. A user can narrow the query results down by specifying an object type and a state. Here’s a bit of RAML that should do what I just said:
/objects:
- searchable:
queryParameters:
object-type:
enum: [Type1, Type2, Type3]
object-state:
enum: [State1, State2, State3]
Now above definition may make the users feel that it's possible to use any combination they want - what is not quite right, as:
- object of 'Type1' can take just 'State1',
- object of 'Type2' can take 'State2' and 'State3',
- object of 'Type3' can take 'State1', 'State2', 'State3'.
Does anyone know how to model that with RAML?
AFAIK that's not possible in RAML. RAML is intended to describe an API, and that is more oriented to be business logic.
Nevertheless, I've heard about this question from a lot of people, and I think that it could be treated in RAML 1.0
Cheers!