Expected behaviour: Only id should be present in response body
Actual behaviour: Both id and name are present in response
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.
Version
4.1.3
Context
Properties which are writeOnly are still appearing in response body
Sample Schema
Expected behaviour: Only id should be present in response body Actual behaviour: Both id and name are present in response
As per the OpenAPI documentation:
readOnly
properties are included in responses but not in requests, andwriteOnly
properties may be sent in requests but not in responses.Do you have a reproducer?
https://github.com/KeerthanaSrikanth/web-and-openapi-howto/tree/writeonly I have added
writeOnly
property to the property tag in thePet
schema.Steps to reproduce
Expected response:
{"id":4,"name":"Alan"}%
Actual response:{"id":4,"name":"Alan","tag":"PQR"}%