{"action":"created","issue":{"url":"https://api.github.com/repos/json-schema-org/json-schema-spec/issues/141","repository_url":"https://api.github.com/repos/json-schema-org/json-schema-spec","labels_url":"https://api.github.com/repos/json-schema-org/json-schema-spec/issues/141/labels{/name}","comments_url":"https://api.github.com/repos/json-schema-org/json-schema-spec/issues/141/comments","events_url":"https://api.github.com/repos/json-schema-org/json-schema-spec/issues/141/events","html_url":"https://github.com/json-schema-org/json-schema-spec/issues/141","id":188504889,"number":141,"title":"Proposal: \"jsonpointer\" type","user":{"login":"erosb","id":273158,"avatar_url":"https://avatars.githubusercontent.com/u/273158?v=3","gravatar_id":"","url":"https://api.github.com/users/erosb","html_url":"https://github.com/erosb","followers_url":"https://api.github.com/users/erosb/followers","following_url":"https://api.github.com/users/erosb/following{/other_user}","gists_url":"https://api.github.com/users/erosb/gists{/gist_id}","starred_url":"https://api.github.com/users/erosb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erosb/subscriptions","organizations_url":"https://api.github.com/users/erosb/orgs","repos_url":"https://api.github.com/users/erosb/repos","events_url":"https://api.github.com/users/erosb/events{/privacy}","received_events_url":"https://api.github.com/users/erosb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":21,"created_at":"2016-11-10T13:12:53Z","updated_at":"2016-12-22T20:02:11Z","closed_at":null,"body":"# Introduction\r\n\r\nWhile the JSON Schema specification itself utilizes JSON Pointers, it has only a very basic support for letting schema authors specify a schema which expects JSON documents to use such JSON Pointers. Currently, when a schema author wants to describe a JSON Pointer, the only thing he/she can do is defining the schema with `\"type\":\"string\"` and probably adding a regex restriction which mandates the string to be a syntactically valid json pointer.\r\n\r\nIn practical usecases it is useful to be able to describe the schema of the referred JSON value. This proposal targets these usecases.\r\n\r\n# Purpose\r\n\r\nThe purpose of this new type is to let schema authors expect that the document being validated contains a [JSON Pointer](https://tools.ietf.org/html/rfc6901), and this pointer denotes a value which conforms to the restrictions of a schema defined by the schema author.\r\n\r\n# Syntax\r\n\r\nExample schema:\r\n\r\n```json\r\n{\r\n    \"properties\": {\r\n        \"ptrToNum\": {\r\n            \"type\": \"jsonpointer\",\r\n            \"referredSchema\": {\r\n                \"type\": \"number\"\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nExample *valid* document against the above schema:\r\n```json\r\n{\r\n    \"ptrToNum\" : \"#/settings/width\",\r\n    \"settings\" : {\r\n        \"width\" : 4\r\n    }\r\n}\r\n```\r\n\r\n\r\nExample *invalid* document against the above schema:\r\n```json\r\n{\r\n    \"ptrToNum\" : \"#/settings/width\",\r\n    \"settings\" : {\r\n        \"width\" : [ 4 ]\r\n    }\r\n}\r\n```\r\n\r\n# Validation\r\n\r\nIf a schema instance has a `\"type\" : \"jsonpointer\"` property , then it must also have a `\"referredSchema\"` key and a  then an implementation should perform the following validation steps:\r\n * it should validate if the value is valid against the `{\"type\" : \"string\"}` schema\r\n * it should check if the string value is a valid JSON Pointer as specified by RFC 6901 (question: [string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6) or both?)\r\n * it should [evaluate the JSON Pointer](https://tools.ietf.org/html/rfc6901#section-4). The result of the evaluation is a JSON value. If the evaluation fails then the validation is unsuccessful\r\n * it should validate the evaluated JSON value against the schema given by `\"referredSchema\"`\r\n\r\n# Notes\r\n\r\n * I'm not sure about the `\"referredSchema\"` keyword , maybe something more expressive can be better\r\n * while writing the above proposal I didn't take the wording of the current spec into account so probably most of it must be re-phrased. I'm also not sure if it should go into the core or the validation spec.\r\n * we should specify what should be done by the implementation if it runs into infinite recursion while resolving JSON pointers\r\n * so please take it as a draft / suggestion in its current form. If I get some positive feedback or some advices then I will create a proper pull request.\r\n"},"comment":{"url":"https://api.github.com/repos/json-schema-org/json-schema-spec/issues/comments/268879026","html_url":"https://github.com/json-schema-org/json-schema-spec/issues/141#issuecomment-268879026","issue_url":"https://api.github.com/repos/json-schema-org/json-schema-spec/issues/141","id":268879026,"user":{"login":"epoberezkin","id":2769109,"avatar_url":"https://avatars.githubusercontent.com/u/2769109?v=3","gravatar_id":"","url":"https://api.github.com/users/epoberezkin","html_url":"https://github.com/epoberezkin","followers_url":"https://api.github.com/users/epoberezkin/followers","following_url":"https://api.github.com/users/epoberezkin/following{/other_user}","gists_url":"https://api.github.com/users/epoberezkin/gists{/gist_id}","starred_url":"https://api.github.com/users/epoberezkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epoberezkin/subscriptions","organizations_url":"https://api.github.com/users/epoberezkin/orgs","repos_url":"https://api.github.com/users/epoberezkin/repos","events_url":"https://api.github.com/users/epoberezkin/events{/privacy}","received_events_url":"https://api.github.com/users/epoberezkin/received_events","type":"User","site_admin":false},"created_at":"2016-12-22T20:02:11Z","updated_at":"2016-12-22T20:02:11Z","body":"> No, one lower layer of abstraction. It is defining the schema of the referred value , pointed by the reference.\r\n\r\n@erosb But why do you need to have a referred value in data? We have doubts even about $data which is less abstract - referring to data from the schema and using it during validation (that seems to have quite a few use cases). You are not only suggesting that we should refer to the data from the data, but also to be able to validate such references.\r\n\r\nEven if there is a use case, I think it is very confusing to use \"type\" keyword for it - we'll need to come up with a different syntax if we agree that there is a sufficiently wide use case... It took me a lot of effort to understand what is the intention. It could be keyword $datapointer that has schema as it's value - what's the point of having two keywords where one is sufficient, particularly when one of them has different meaning completely?\r\n\r\nIn any case, I still don't understand the use case..."}}
{"actor":{"display_login":"epoberezkin"}}