How to make Request Body accept empty body as well as JSON?

#1

Hi everyone

Does anyone know how to make the request body optional in RAML specs?

We want to be able to use PATCH on the same endpoint for two different cases:

  • queryParams supplied, with empty body
  • no queryParams, with JSON body

However, our error handling kit keeps catching the first case with the empty body as 415 Unsupported Media Type. Has anyone ever had to do this before?

Thanks
Desy

0 Likes

#2

@dkristianti-dtt: Welcome! Are you trying to make the body schema conditionally enforceable depending on the presence or not of queryParams? Would you mind sharing an example of the RAML you have written so far?

0 Likes