Skip to content

Instantly share code, notes, and snippets.

@glanotte
Last active August 29, 2015 14:22
Show Gist options
  • Save glanotte/421892bdc40bb02b429e to your computer and use it in GitHub Desktop.
Save glanotte/421892bdc40bb02b429e to your computer and use it in GitHub Desktop.
Collection+JSON item-error extension
{
"collection": {
"version": "123",
"items": [{
"href": "http://example.com/contacts/1",
"data": [
{"name": "id", "value": "1"}
]
},{
"item-error": "This object is invalid",
"data": [
{"name": "id", "value": ""}
]
},{
"href": "http://example.com/contacts/2",
"data": [
{"name": "id", "value": "1"}
]
}]
}
}
@glanotte
Copy link
Author

glanotte commented Jun 8, 2015

Interesting thought, for our current scenario - I don't think so. Overall, I think it is a great idea. I think I would prefer that to listing off errors in the errors object. In our scenario it is going to matter less what the exact error is. We are going to care more about which objects had errors. Down the road though, I could see us using an error on the data array.

@mamund
Copy link

mamund commented Jun 9, 2015

@glanotte

ok, i think i see what you're saying. you want an error property on the item, not the data element (as i suggested) and not just on the representation (where it is now).

so, are you ok, w/ a single string ("itemerror" : "not valid" )?
would a boolean work just as well ("itemerror" : "true")?
do you really need an object here? ("itemerror" : {"code" : "123", "message" : "invalid object"})?

do you plan do use something at the data level at some point?
in human-drive UIs, how do you see this "itemerror" being handled? rendered as a message? something else?

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