RE: W3C standardization process

On Saturday, January 25, 2014 12:52 AM, James Langley wrote:
>> So you want to manipulate the JSON representation directly instead
>> of mapping it to domain POJOs, right?
> 
> Exactly. We have the concept of the client being able to call the API,
> and the API having to invoke multiple calls to other areas of the API
> to satisfy the client's request. Each of these internal calls will
> return JSON and so we would rather merge the JSON directly, not
> convert into POJOs, merge POJOs, then convert back from POJO -> JSON.

That definitely makes sense. Would an API similar to the one I described in
my previous mail satisfy your needs or is there something missing?


>> The general approach would be to either define a property or a class
>> that you include/exclude based on the resource state. Something like
>> 
>>   {
>>     "@id": "just-an-entity",
>>     "@type": [ "BlogPost", "PublishedBlogPost" ],
>>     "comments": "just-an-entity/comments"
>>   }
>> 
>> In this case, the operations that are supported on all posts are
>> associated to the "BlogPost" class. The operations only applicable
>> to published posts are associated to the "PublishedBlogPost" class.
> 
> Can we associate an entity with multiple classes if the classes are
> not hierarchical? (In this example PublishedBlogPost would seem to be
> a subclass of BlogPost.)

Yes, as long as the classes are not defined as being disjoint (by default
they aren't) you can associate an entity with as many classes as you want.


>> Do you need to document the circumstances under which each class is
>> returned or is it enough to know that you may get different
>> responses?
> 
> Good question. I need to think a little more about this.

Documenting the circumstances in a generic, machine-readable manner probably
becomes very complex quickly. Of course you can always describe it in
natural language in an operation's description but that won't help you much
if you need to use that information programmatically.


>> Btw. please don't conflate a JSON-LD context (which maps JSON
>> elements to URLs) with a Hydra description (which describes your
>> service).
> 
> I think I need to go back and do some re-reading to make sure I've got
> that 100% straight in my own mind.

Don't hesitate to ask if you questions. Hydra's documentation could
certainly be improved.


--
Markus Lanthaler
@markuslanthaler

Received on Sunday, 26 January 2014 19:05:09 UTC