Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an optional "readOnly" property for items #12

Open
mamund opened this issue Mar 5, 2015 · 5 comments
Open

add an optional "readOnly" property for items #12

mamund opened this issue Mar 5, 2015 · 5 comments
Assignees
Milestone

Comments

@mamund
Copy link
Member

mamund commented Mar 5, 2015

add an optional readOnly property for items. This will make it easier for clients to know which items are eligible for update or deletion.

readOnly="true" : this item SHOULD NOT be edited using the supplied template and is not delete-able
readOnly="false" : this item MAY be edited using the supplied template
if the readOnly property is missing that item SHOULD be assumed to be eligible for edits and deletions.

Document authors can still include entries in the links collection for each item that point to representations that include a template for use in editing (e.g. rel="edit" or rel="delete"). This will make it easier to indicate custom edit templates for individual items.

This is a backward-compatible change. There is no breaking change to the format. Clients SHOULD already ignore properties they do not know.

@carlesjove
Copy link
Contributor

There's a registered extension for this. I think the only thing to clarify here would be the name: camelCase vs separate-words. At the registered extension they use separate-words.

@mamund
Copy link
Member Author

mamund commented Mar 6, 2015

yep, this is an attempt to move the extension into the main spec doc. i've found this extension very useful!

so, onto the naming. i prefer not to introduce dashes into Cj since it adds some burden to parsing the JSON since "dashed" properties need to be addressed using brackets:

items[0]["read-only"] vs. items[0].readOnly

i am also ok w/ using all lower case:

items[0].readonly

finally, would love to hear from others using the extension. how do you feel about adding this to the spec? does changing the name cause enough problems to make a case for just leaving it as a "dashed" element? do you find the dash causing any added burden in parsing (as i claim)? or is it no big deal?

@mamund mamund modified the milestone: cleanup Mar 11, 2015
@carlesjove
Copy link
Contributor

Hi @mamund

I'm already including extensions on the Ruby CJ::Serializer. For now, I'll add "read only" as an extension, and will later move it to the spec if it's finally merged.

Just to clarify:

  1. The attribute name is finally readOnly, right?
  2. Is it ok if I send a PR to the extension draft, so we have a naming consistency all around?

cheers

@mamund
Copy link
Member Author

mamund commented Mar 17, 2015 via email

@carlesjove
Copy link
Contributor

I'll rather wait until you decide on the name. It's not really an urgency.

Let's ping @pmhsfelix and see what he's got to say ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants