-
-
Notifications
You must be signed in to change notification settings - Fork 214
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realise I should actually query this on the schema repo, but as it's here, and in one PR... Plus it's probably just my lack of understanding and nothing actually wrong with it.
draft-06/hyper-schema
Outdated
"links": [ | ||
{ | ||
"rel": "self", | ||
"href": "{+id}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a URI template: https://tools.ietf.org/html/rfc6570#section-3.2.3 and this link says that the meta-schema document itself lives at the URI of its own "$id", which (except for having left out the "$") is correct.
But now it should be "{+$id}" except that "$" is excluded from template variable expressions and reserved for pre-processors, so I guess we have to go back to saying that we have a preprocessor that just allows "$"? Ugh. Not enough caffeine for this.
I'll have to submit a PR on the other repo when I can figure out how to handle this, and after that's approved update the PR here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Have you tracked this issue on the spec repo? (I'm half asleep here =[ )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,47 @@ | |||
{ | |||
"$schema": "http://json-schema.org/draft-06/hyper-schema#", | |||
"$id": "http://json-schema.org/draft-06/links#", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the $schema and $id here set as they are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the links meta-schema is itself a hyperschema (and its self link also needs to be changed from "{+id}" to "{+$id}" or however we end up dealing with that). And the links schema has its own id, of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right. Yeah, with you on that now. Duh.
}, | ||
"schema": { | ||
"description": "Schema describing the data to submit along with the request", | ||
"allOf": [ { "$ref": "hyper-schema#" } ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be schema# or hyper-schema#? I'm not sure I really understand...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hyper-schema. Requests, responses, and representations in general are hypermedia documents. Why wouldn't they be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To my mind, if schema
describes the data being submitted with the request, it is the schema for the json, which would be schema#
. Why would I include LDO information in my request payload? Or am I missing something really important to understanding this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two reasons:
- HATEOAS. The server may want to examine a resource related to the request representation. In which case the server needs to understand how to build links from the request.
- Convenience. For a POST that is creating via a collection, I want to
"$ref"
the same representation everywhere (POST request to create, and the regular representation which is used as both PUT request and GET response).
But the primary answer is HATEOAS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reads up on HATEOAS. OK then. Consider me convinced. I think I've read up on HATEOAS before and not understood or just forgotten. Welcome refresh.
}, | ||
"targetSchema": { | ||
"description": "JSON Schema describing the link target", | ||
"allOf": [ { "$ref": "hyper-schema#" } ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as below comment.
as decided in issue json-schema-org/json-schema-spec#165. Also add a README to explain why there's nothing in a Draft-05 directory, because people keep asking about that.
@Relequestual I've copied over the fix for the self link so these meta-schemas should be correct now. |
as decided in issue json-schema-org/json-schema-spec#165.
Also add a README to explain why there's nothing in a Draft-05
directory, because people keep asking about that.