danielgtaylor / danielgtaylor/huma
Does readOnly actually do any validation?
- Dominant language
- Go
- Stars
- 4.4k
- Forks
- 285
- Avg merge
- 40m
- Merged PRs (30d)
- 1
Description
Quick question. Using the `readOnly` tag. I can see that it effectively removes the field from the documentation for POST/PATCH requests, but it doesn't actually seem to have any validatory effect.
To be specific. My struct has a field `daysOld` which is marked 'readOnly'. Although the field doesn't show in the docs, I can add it to a PATCH request and no error is raised and the field is effectively written to the server.
My expectation was that adding the 'readOnly' field would mean that if the field were included in a PATCH request, either an error would be raised or it would just be ignored. Perhaps I've missed something here? Thanks.
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue names no files or tests. Start by tracing how the readOnly tag is handled during PATCH request validation and compare that behavior with the generated OpenAPI schema. Done means the behavior for a readOnly field included in a PATCH request is defined and covered by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, openapi
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100