-
-
Notifications
You must be signed in to change notification settings - Fork 5
templating for "rel" and other LDO keywords #1
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
Curly braces aren't even legal in URIs or URI references, hence their use |
@awwright true, I just copied and pasted this one without reading it too closely. Should I edit the initial comment to take out the stuff about { and } in URIs? |
@awwright I removed the discussion about {braces} as you suggested. I also took the gigantic quote out of your comment because it added doubled the length of the conversation without (I think) adding much. I hope that is OK, my apologies if not (it's easy enough to restore if you'd prefer). |
I'm having trouble figuring out the use case here. If On the other hand, if both {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"id": {"type": "integer", "minimum": 1}
"animalType": {"type": "string"}
},
"links": [
{
"anchorPointer": "",
"rel": "tag:example.com,2017:pet-{animalType}",
"href": "pets/{id}"
}
]
}
} So if you have something like: {
"Fido": {
"id": 1,
"animalType": "dog"
},
"Derp": {
"id": 2,
"animalType": "cat"
}
} then you now have two links from the person resource, one of type "pet-dog" and one of type "pet-cat". Technically, you can only do this with Does anyone have a use case for this? Does anyone feel strongly enough about this that it's worth keeping open? If not, I'm inclined to close it. If we find a new use case, we can open it again. |
I actually came up with a use case for this. As a use case, it's contrived, but it's contrived from a real-world JSON format, JSON-HAL: This hyper-schema would make non-templated, non-curied JSON HAL links usable by hyper-schema clients. Said clients would have to figure out whether they've ended up with a curie or a usable URI, which is the contrived / incomplete part. The The {
"properties": {
"_links": {
"additionalProperties": {
"links": [
{
"rel": "{propertyName}",
"href": "{href}",
"templatePointers": {
"propertyName": "0#",
"href": "0/href"
},
"templateRequired": ["href"]
}
]
}
},
"_embedded": {
"additionalProperties": {
"oneOf": [
{"$ref": "#"},
{"items": {"$ref": "#"}}
]
}
}
}
} |
s/resolution scope/base URI/
pull in updates
pull in updates
Originally written by @geraintluff at https://github.com/json-schema/json-schema/wiki/More-templating-(v5-proposal)
Proposed keywords
Uses existing keywords - proposes extension of
rel
in LDOs.Other keywords in LDOs could also be subject to this (e.g.
mediaType
) - however,rel
is the most obvious candidate as it is also a URI.(Yes, in case that was unclear - link relation values are basically all secretly URIs.)
Purpose
Currently, the only property of links that is templated is "href". However, some data formats actually include other link information in the data as well - most often
rel
(although sometimes others such as media type).Values
The allowed values would be exactly the same as for
href
(including the extended templating syntax from issue json-schema-org/json-schema-spec#52 , if applicable).Behaviour
To obtain the value for the link relation, the value of
rel
is interpreted in exactly the same way ashref
.Concerns
As such, it is probably safe to allow
rel
to have the same behaviour ashref
, and this is unlikely to cause incompatability with existing v4 schemas.If
$data
makes it into the standard, then we probably don't need to enable templating for anything apart fromhref
andrel
- everything else can be referenced wholesale from the data.The text was updated successfully, but these errors were encountered: