rspec-openapi icon indicating copy to clipboard operation
rspec-openapi copied to clipboard

Suggestion for the readOnly property

Open AlexeyMatskevich opened this issue 1 year ago • 1 comments

I believe many people use id or uuid in their schematics. And always, this field is read-only.

I suggest to automatically set readOnly: true for such fields.

AlexeyMatskevich avatar Aug 19 '23 04:08 AlexeyMatskevich

I think this is a bit controversial change.

https://swagger.io/docs/specification/data-models/data-types/#readonly-write-only image

readOnly properties are included in responses but not in requests, and writeOnly properties may be sent in requests but not in responses

If I understand correctly, readOnly: true indicates that that field id only in API responses. I am not sure that id or uuid can be omitted in API requests for many people.

If someone wants to contribute to this, I suggest that this feature is disabled by default and requires a flag to enable it.

exoego avatar Sep 09 '23 10:09 exoego