Here's an example spec:
openapi: 3.1.0
paths:
/users/123:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/userObject'
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/userObject'
components:
schemas:
userObject:
type: object
required:
- password
properties:
name:
type: string
password:
type: string
writeOnly: true
The following response body should pass validation, because password is write only. password is only required on the request body.
But currently the validator returns the following error:
[Error: 201 response body for '/users/123' failed to validate schema, Reason: The response body for status code '201' is defined as an object. However, it does not meet the schema requirements of the specification, Validation Errors: [Reason: missing property 'password'], Line: 19, Column: 7]
Here's an example spec:
The following response body should pass validation, because
passwordis write only.passwordis only required on the request body.But currently the validator returns the following error:
[Error: 201 response body for '/users/123' failed to validate schema, Reason: The response body for status code '201' is defined as an object. However, it does not meet the schema requirements of the specification, Validation Errors: [Reason: missing property 'password'], Line: 19, Column: 7]