Feature #3818

[API] Discovery document schema should include whether field on resource is writable or read-only.

Added by Peter Amstutz over 4 years ago. Updated about 4 years ago.

Status:
New
Priority:
Normal
Assigned To:
-
Category:
API
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Story points:
1.0

Description

Read-only fields are:
  • modified_* and created_at (which are attr_protected)
  • updated_at (which should be either removed outright or protected with attr_protected)
  • (any others?)
Notes
  • attr_protected can surely be introspected, but is deprecated in rails 4.
3818-try1.patch (11.8 KB) 3818-try1.patch Brett Smith, 03/29/2015 05:25 PM

History

#1 Updated by Peter Amstutz over 4 years ago

  • Description updated (diff)

#2 Updated by Peter Amstutz over 4 years ago

  • Subject changed from Discovery document should include whether field is writable or read-only. to Discovery document schema should include whether field on resource is writable or read-only.

#3 Updated by Peter Amstutz over 4 years ago

  • Subject changed from Discovery document schema should include whether field on resource is writable or read-only. to [API] Discovery document schema should include whether field on resource is writable or read-only.
  • Category set to API

#4 Updated by Peter Amstutz over 4 years ago

  • Target version set to Arvados Future Sprints

#5 Updated by Tom Clegg over 4 years ago

  • Description updated (diff)

#6 Updated by Peter Amstutz over 4 years ago

  • Story points set to 1.0

#7 Updated by Brett Smith about 4 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.

Also available in: Atom PDF