-
Notifications
You must be signed in to change notification settings - Fork 471
Resources should match the Collection+JSON convention #16
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
Comments
I would be hesitant to get behind any one JSON structure spec right now because there are several good contenders and each of them has something good in them (though I find all of them generally lacking in balance...e.g. they solve one problem well at the expense of others). I don't really like this structure for JSON because it is, IMO, unnecessarily verbose. It combines a schema-like structure definition with the actual data, which I don't think is a good idea and too similar to XML, which is proven to be very prone to overuse and overkill. The "templates" here are an attempt to separate the structure of the document with its data, but even using a template one still has to include elements of a structural definition in the data (e.g. JSON Schema is actually much cleaner in that regard. It separates the description of the structure of the document with its actual data. Being able to externally define a document is beneficial in a large set of use cases, particularly if you are generating forms, or otherwise creating helpers that want to interact with the expected data. It's also possible to mix-in document structures for a very flexible schema. I can't see that being possible with the static nature of the Collection+JSON approach. So far as I could see, this solution also doesn't address linking of data (providing a IMO a balanced approach would be to take something like JSON Schema (but with far fewer variances on the types of nodes within a schema to make parsers and validators far easier to write) and combine that with a JSON-LD type linking schema. It may be that HATEOAS needs to provide Resource as a marker interface and provide implementations that are structured differently based on these various specs. |
You mean something like this:
Maybe with relevant builders/factories, something like:
|
Superceded by #482 |
Recently came across this syntax for collections of JSON object:
http://www.amundsen.com/media-types/collection/
and wondered if the Resources generic type in spring-hateoas should meet it? Discussion?
The text was updated successfully, but these errors were encountered: