Extension proposal: 'type' attribute for the link object

23 views
Skip to first unread message

Michael Levy

unread,
Jun 14, 2015, 4:47:09 PM6/14/15
to collect...@googlegroups.com
the Cj spec defines the link object as having five properties: href (REQUIRED), rel (REQUIRED), name (OPTIONAL), render (OPTIONAL) and prompt (OPTIONAL). None of which can be used by the server to indicate [1] the type of the referenced resource. I'd like to propose an extension to add another optional attribute, 'type', for this purpose. The value would be a string and should contain a valid media-type.

Thoughts?

-Mike

[1] "hint" is a common word used by many of the available Hypermedia types

mca

unread,
Jun 14, 2015, 4:51:19 PM6/14/15
to collect...@googlegroups.com
i think this is a good idea. defining an optional property "type" or "hint" or "format" or "accept" etc can be valuable.

i don't want to bog this down too much but does it make sense to do the same/similar for the "template" object? that might be too much since templates work with both "content-type" values (the format of the message you _send_ from the client) and "accept" values (the format of the message you expect to _receive_ from the server).

i'm cool with just focusing on links for now.

write up a gist with the example and post it here and we can discuss it.

cheers.

--
You received this message because you are subscribed to the Google Groups "Collection+JSON" group.
To unsubscribe from this group and stop receiving emails from it, send an email to collectionjso...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Levy

unread,
Jun 16, 2015, 7:46:16 PM6/16/15
to collect...@googlegroups.com
>> write up a gist with the example and post it here and we can discuss it.


-Mike
--
- Mike

Michael Levy
Microsoft Practice Director
michae...@sds-consulting.com
cell: 513.218.6696

Agility │ Mobility │ Usability
Custom development. Better results.
www.sds-consulting.com  

 Strategic Data Systems: Custom application development partner and technology resource that provides agile project leadership through an end-to-end team of experts in Requirements, User Interface, Application Design/Architecture, and Database Development.

NOTICE: This communication may contain confidential or privileged information. Do not print, copy, forward, or otherwise use the information for any unintended purpose. Also, if you are not the intended recipient, immediately notify the sender that you have received this email in error, and delete the copy you received. Thank you.

mca

unread,
Jun 22, 2015, 11:21:52 AM6/22/15
to collect...@googlegroups.com
mike:

sorry for the slow response. i like this extension and have heard others mention the need for it. thanks for working on this.

two suggestions to add to the discussion:

1 - "type" may end up being used for the "data" elements. this is not a direct conflict, but might be worth considering using some other word for your case. maybe "accepts" (since it matches the HTTP header that will carry this data on request) or "hint" (as that is close to what it really is?) or somethign else? again, not a killer thing, but looking ahead

2 - we should be prepared for ppl to supply more than one value here: "accepts" : "application/pdf, text/plain" so far, Cj has used a comma-sep list for this stuff (see the "rel" property) but some have used arrays for this kind of thing (since it is more JSON-ish). I prefer to stick to c-sep lists but am open to discussion on this one.

let's discuss.

Michael Levy

unread,
Jun 24, 2015, 10:07:45 AM6/24/15
to collect...@googlegroups.com
I think I mentioned that I originally proposed 'type' because it was commonly used in other media types for this purpose and I see some benefit in staying consistent. With that said, I have no problem using 'accepts' and I do like the idea of allowing it to contain multiple value.

I post an updated gist.

Michael Levy

unread,
Jun 24, 2015, 9:10:05 PM6/24/15
to collect...@googlegroups.com
I've created a new gist showing the use of an 'accepts' property as a string of comma-separated media types.


-Mike

mca

unread,
Jun 24, 2015, 9:44:10 PM6/24/15
to collect...@googlegroups.com

Looks good to me. Anytime else have comments?

Reply all
Reply to author
Forward
0 new messages