SampleObject:
type: object
description: Sample description
required:
- id
- name
properties:
id:
type: string
name:
type: string
readOnly: true
Expected validation behaviour: Only id should be required in request bodies
Actual behaviour: io.vertx.ext.web.validation.BodyProcessorException: [Bad Request] Validation error for body application/json: provided object should contain property name
As per the OpenAPI documentation:
readOnly properties are included in responses but not in requests, and writeOnly properties may be sent in requests but not in responses. If a readOnly or writeOnly property is included in the required list, required affects just the relevant scope – responses only or requests only. That is, read-only required properties apply to responses only, and write-only required properties – to requests only.
Is this a bug or is there a way to have the expected validation behaviour?
Thanks,
Keerthana