Suppose you have the following OpenAPI requestBody specification:
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
field1:
type: number
default: 1
field2:
type: object
properties:
subfield:
type: number
default: 2
The request body contains:
- a
numberfield with default value 1 - an
objectfield, containing itself anumberfield with default value 2
If a client sends an empty payload, we should agree that field1 value is supposed to be 1, but what about field2 value?
field2is not specified, so it must be considered as nullfield2should be an object build with default values:{subfield: 2}- OpenAPI does not answer this question and that's up to me to decide what my application should do