-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
format: add uritemplate and jsonpointer #109
Comments
@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 |
@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] {
"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 |
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! =] |
Addresses issue json-schema-org#109 by adding "uritemplate" and "jsonpointer", as defined by their RFCs, both of which already play roles within JSON (Hyper-)Schema. We use "uritemplate" in hyper-schema, but until the preprocessing step is removed we technically can't put the format in the meta-hyperschema. This is being addressed elsewhere. While we do not need "jsonpointer" for our meta-schema, it is used for schema+json URI fragments, and in other JSON-based media types such as JSON Patch.
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.
The text was updated successfully, but these errors were encountered: