Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

Collection+JSON renderer #140

Open
leplatrem opened this issue Jan 20, 2014 · 10 comments
Open

Collection+JSON renderer #140

leplatrem opened this issue Jan 20, 2014 · 10 comments

Comments

@leplatrem
Copy link
Contributor

http://amundsen.com/media-types/collection/

@leplatrem
Copy link
Contributor Author

@davidbgk
Copy link

@leplatrem let me know if you need some help on that integration, I'd love to work with you :)

@leplatrem
Copy link
Contributor Author

Oh great thanks, same for me! I feel honoured ;)

If you're willing to help on this, this is good news! :) We sometimes meet on freenode#daybed

First step would be to choose the most relevant default format among all of them!

So far the default data view does not follow any normalized layout :

{"data": [
   {
      "age": 120,
      "name": "jeanette"
   },
   ...
 ]}

This one looks pretty interesting too : http://json-schema.org/latest/json-schema-hypermedia.html

Notable parts of the code for this :

Related story #139 (browsable API, HATEOA)

@davidbgk
Copy link

I don't have any particular preference regarding the format. Current trends are https://github.com/kevinswiber/siren and http://json-ld.org/ (that is now a W3C recommendation: http://www.w3.org/blog/news/archives/3589)

My initial question is: "Why would you like to add hypermedia to your API?"

@leplatrem
Copy link
Contributor Author

Well, let's say there are two ideas :

  • serve records collections using a normalized layout (this issue) ;
  • bring some browsability in general for easier exploration and auto-discovery (issue Browsable API #139)

Regarding the former, I would say that normalized output is generally sane, because it would save us from implementing custom connectors for most clients or frameworks (see existing list for collection-json)...
Well, even if I must admit that the current implementation is quite straightforward to plug (ex. with backbone)...

I find it hard to choose the default layout too, trends move! But as long as they have different mimetype or profile we can add several serializers without having to argue :)

@leplatrem
Copy link
Contributor Author

@davidbgk I guess you heard that 3 prestigious mozillians have joined the party :) Are you still willing to give a hand ?

@davidbgk
Copy link

davidbgk commented Jun 2, 2014

@leplatrem sure it's always a pleasure to work with mozillians ;) I don't want to slow things down though, do you plan to work on it soon?

@leplatrem
Copy link
Contributor Author

Oh, don't worry! Since it's remained a side-project for me, I don't care about productivity :)

n1k0, alexis and natim seem to be able to spend 1 day/week with a roadmap. Of course, it gave us a serious boost of motivation!

But just pick up what you like and enjoy most !

@Natim
Copy link
Member

Natim commented Jul 30, 2014

I may starts using json-ld, siren looks a bit to heavy for me.

@Natim
Copy link
Member

Natim commented Jul 30, 2014

So basically, all we need is to add:

@id with a link to the item
@context with a link to the context description.

This means we will have to be able to return a model on a @context compliant form: See http://www.w3.org/TR/json-ld/#the-context

To do so, we will need to define a schema on each field type.

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

No branches or pull requests

3 participants