--
You received this message because you are subscribed to the Google Groups "JSON Schema" group.
To unsubscribe from this group and stop receiving emails from it, send an email to json-schema...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
on-topic: I understand that the format of the links differs here and there, but this won't make the world a better place :) it will just make it more flexible, in a world where some other people are pushing in the order direction to create standards (HAL, Siren, etc). This change btw won't cover the HAL style {links: {someRel: {href: X}}}, will it?I personally don't see any problem with the current link definition. Might be coincidence, but this is how I coded examples, even before meeting JSON Schema
Off-topic: one amendment if I may: add "value" or "constant" definition. Enum does the trick, but it's a semantic workaround IMO, but it's minor. And I do like using one and only one prop that is a list of items, even if the length is 1 (eg. "extends" rather than "extendOne" + "extendMany"){"enum": ["1"]}vs{"value": "1"}{"const": "1"}{"constant": "1"}
Request to hijack this thread. A birdie whispers "Granted", and the shit hits the fan.I think this tries to solve smth on a lower-level than the level of the problem itself.A bit of my work context - a JSON schema describes a media-type. That media-type may be used by 5 resources (please slap me if I'm RESTish and I lose focus). Each resource may link to diff other resources, plus each resource may or may not show the links, depending on state, authorization, etcGiven that, in my current context I should not have any links in JSON Schemas. I do it though via a generator by collecting all possible links that those 5 resources can have, and putting those in all media-types that those resources can respond with. This is mainly for spec-ing (makes it visible what is possible to implement) and for documentation convenience (if you get X, then that X could maybe give links to Y, Z,..).So, after the whole blob above, what I'm trying to say is that one should maybe possibly... :) [mind me, I'm really not trying to start a fire] NOT have links in the JSON Schema describing the instance.1) If I get some JSON instance, why assume that I can now go to another JSON instance?2) If the JSON schema describes a representation, then why would 2 representations of the same resource have different links? which can easily happen
Coming back to the original thread=========================It only now hit me that you initially wrote:"This makes JSON Schema incapable of describing JSON formats that include the links in the data, if the link format does not match up exactly with the link format in JSON Hyper-Schema. It also means that you have to either specify all aspects of the link, or move the entire link definition to the schema."In what way does JSON Schema restrict my format, may it be HAL, Siren, etc ?I believe I am very much able to describe any format I want. {"type": "object", "properties": {...anything goes here..}}Indeed, with the overhead of1) either linking to elements of the http://siren.com/links schema
2) either specifying myself how the link structure looks likebut that overhead is because of flexibility.{"properties": {"links": {"$ref": "https://json-schema.org/hyperschema"}}}vs{"properties": {"links": {"properties": {"uri": {"$ref": "https://json-schema.org/hyperschema#/properties/href"}, "relation": {"$ref": "https://json-schema.org/hyperschema#/properties/href"} }}}vs{"id": "customhyperschema", ...}{"properties": {"links": {"$ref": "customhyperschema"}}}Am I off base here?
On Thursday, February 21, 2013 12:31:48 PM UTC+1, Geraint (David) wrote:On 20 February 2013 22:47, Andrei Neculau <andrei....@gmail.com> wrote:on-topic: I understand that the format of the links differs here and there, but this won't make the world a better place :) it will just make it more flexible, in a world where some other people are pushing in the order direction to create standards (HAL, Siren, etc). This change btw won't cover the HAL style {links: {someRel: {href: X}}}, will it?I personally don't see any problem with the current link definition. Might be coincidence, but this is how I coded examples, even before meeting JSON SchemaThe thing is that JSON (Hyper-)Schemas are documents that describe data formats - the JSON Schema specification should not affect your data format at all. Currently, there are hyper-text formats which JSON (Hyper-Schema) cannot describe. If using JSON Schema to describe your format restricts your format in any way, then we're doing something quite wrong.Imagine a similar scenario that is not hyper-text, but plain old structural constraints on data. You have some data format, but somehow the language of JSON Schema is insufficient to describe it. The answer at that point should not be for you to change your data format so that JSON Schema can describe it - the answer is that JSON Schema is missing some required functionality.So I find it extremely difficult to accept any solution that says "HAL does things one way, Siren another, and JSON Schema yet another". JSON Schema is not a data format! It is a language for describing data formats, and if there are formats we cannot describe then that is a problem.Also, you are right - this proposal would not cover HAL-style links, and thus is incomplete. I would welcome suggestions for an alternative syntax that could cover that case as well.
OK - I really want to clarify something here: are you talking about actual links, or link descriptions?
Actual links (as in, the actual URIs) should in general not be in the schema. What the schema holds is a description of where to find links in the data. The actual link itself is not in the schema.
OK - I really want to clarify something here: are you talking about actual links, or link descriptions?
Actual links (as in, the actual URIs) should in general not be in the schema. What the schema holds is a description of where to find links in the data. The actual link itself is not in the schema.Irrelevant to my example IMO, but link descriptions. Irrelevant thought because you cannot describe links (to an API client) prior to asses state, authorization etc (in some cases).I would rephrase smth that you said though: "What the schema holds is a description of how to find spec-ed links and how to build their URIs from the data". Like the example on Page 3 http://tools.ietf.org/html/draft-luff-json-hyper-schema-00 ---- by looking at the schema of a Written Article, I know that an instance of a Written Article will link to "full" and "author" via {id} and /user?id={authorId}.Right?Coming back - I'm starting to get a grip of what you're trying to do. Give me a chance to phrase it.In the example you give in your first post, you're actually telling the "json schema reader": hey, each item in "links" actually has 1 link with href pointing to the value of the "uri" key, and with mediaType pointing to the value of "type".Off base?
If I'm correct, then what I don't get is what is the difference between"href": {"template": "uri"}and"href": "{uri}"?
Granted there is still issues - only the URI can be a "URI template", so you cannot do today "mediaType": "{type}"..... talking out loud here.
Thanks for the patience! It's a nice idea (you already know that :) ), but I wonder how much do you get out of it.I'm speaking from the top of my head.. but there is basically the HAL style, and the "say JSON Schema" style (some have links, some _links), and nested or only first-level links. I hope there's not going to be more variations without arguments for breaking out.