Closed handrews closed 7 years ago
@Relequestual @awwright @epoberezkin any thoughts? This should be a pretty straightforward yes or no, I think. Just a question of "do we want enough defined formats to be able to identify the formats on which JSON Schema itself depends?"
+1 for jsonpointer
, I'm neutral about uritemplate
.
@erosb same here
@epoberezkin @erosb why less interested in uritemplate? It is a distinct format from uri and urireference and one on which we are entirely dependent for hyper schema (currently in two different keywords, href and base). Being able to express our own usage seems beneficial, particularly given the optional nature of format.
@handrews Could you give examples of both? I'm not familiar with either, and therefore how this would look, which makes it difficult to know if I'm for or against.
[edit: haven't had caffeine yet, was using $ref wrong, took it out]
@Relequestual uritemplate is what we use for href
and base
. So in the meta-schema:
{
"type": "object",
"properties": {
...,
"href": {
"type": "string",
"format": "uritemplate"
},
"base": {
"type": "string",
"format": "uritemplate"
},
...
}
}
@Relequestual currently we don't have anything where we only use JSON Pointer, but JSON Pointer is the fragment syntax we use in $ref
. Some proposals use JSON Pointers directly instead of as part of URIs.
Here is a better use of JSON Pointer. This is a (probably not quite right) schema for the JSON Patch media type:
{
"type": "array",
"items": {
"type": "object",
"required": ["op", "path"],
"properties": {
"path": {
"type": "string",
"format": "jsonpointer"
}
},
"oneOf": [
{"properties": {"op": {"const": "remove"}}},
{
"required": ["value"],
"properties": {
"op": {"enum": ["test", "add", "replace"]},
"value": {}
}
},
{
"required": ["from"],
"properties": {
"op": {"enum": ["move", "copy"]},
"from": {"type": "string", "format": "jsonpointer"}
}
}
]
}
}
Created a PR for an other way of defining json pointers: #141
OK, I feel I understand now. I'm for this! =]
Resolved by PR #150.
We currently have uri and uriref for indicating an expectation of RFC 3986 conformance. While I don't think we should have formats for all RFC-defined things, since hyper-schema itself relies on URI Templates (RFC 6570) and JSON Pointer (RFC 6901), it seems reasonable to include them. It would make our meta-schema more clear as well.