Need general advice

Hello everyone,

Often when Im writing my api specifications I find myself describing the object that a client would send (for creating a resource for example) and a very similar object that the backend would send (on GET for example). Often these 2 objects only differ in the id field, the client does not decide the unique identifier. But I wonder if its common practice to create these 2 DataTypes and name them something like “car_post”/“car_get”, to me this sounds strange but maybe Im looking at it the wrong way?

Cheers!

Re-use is one of the great benefits of RAML so it’s definitely encouraged to take advantage of it.

For example, when defining standard CRUD resource payloads, typically using the application/json media type and returning JSON objects, one can create a base datatype which all methods inherit from, adding additional properties if necessary (e.g. id property for a collection-item GET method), or encapsulating such base datatype in an array for example (e.g. baseType[] for a collection GET method).

I would invite your to check-out the different examples on raml-org/raml-examples.