[API] Discovery document schema should include whether field on resource is writable or read-only.
- modified_* and created_at (which are attr_protected)
- updated_at (which should be either removed outright or protected with attr_protected)
- (any others?)
- attr_protected can surely be introspected, but is deprecated in rails 4.
#7 Updated by Brett Smith about 6 years ago
I started going down this path to try to address an issue I was encountering in #4253. I eventually found out that Workbench has other infrastructure to solve my issue, so I switched to using that, but here's my work in progress for posterity.
This patch hacks up the schema controller to put all API attributes in the discovery document, whether they're in the database or not. It also marks non-database attributes as readonly. It could be extended to advertise that flag for other protected attributes without too much trouble.
This patch also starts teaching Workbench to deal with the newly-advertised attributes correctly. What's left to be done is to clean up some of the workaround code that Workbench already has for cases like these. That's necessary to avoid conflicts between the new handling code and the old handling code: a handful of Workbench tests are failing after this patch.