Specify body must not be empty and it has to conform to schema


Is there a way, besides specifying that a structure of a request body has to adhere to given schema, at the same time to specify that a request body must not be empty?


I don’t believe so.


In JSON schemas you can define “required” elements.

"type": "object",
"properties": {
"name": { "type": "string" },
"email": { "type": "string" },
"address": { "type": "string" },
"telephone": { "type": "string" }
"required": ["name", "email"]

But this is where json schemas get muddy… dont know how to do it on xml, and I would assume that if you use non-schema definitions (i.e. application/x-www-form-urlencoded)

              description: Param1 description...
              required: true
              type: string
              enum: [details, method, location]
              example: details   

you can specify if each body param is required or not.