Inheritance of resources


#1

Hello there, I stumbled upon a use-case that I seem to not be able to model in RAML. I’m interested in reusing sub resources for different top-level resources.

Let me illustrate with an example. Suppose we have the following resources:

/cars:
  type:  { collection: {entity : Car } }

/trucks:
   type:  { collection: {entity : Truck } }

Here collection is defined as a trait, but that shouldn’t matter for the question. But now I have versions for both of these entities and need to have the following sub resources:

/cars/versions
/cars/versions/{id}
/cars/versions/{id}/etc
/trucks/versions
/trucks/versions/{id}
/trucks/versions/{id}/etc

Is there a way to define the /versions endpoints at one place and then reuse them for whatever endpoints I need (and take into account the they could be used in a lot of top-level entities and the sub resources can have a lot of endpoints).