{"action":"created","issue":{"url":"https://api.github.com/repos/whitlockjc/json-refs/issues/47","labels_url":"https://api.github.com/repos/whitlockjc/json-refs/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/whitlockjc/json-refs/issues/47/comments","events_url":"https://api.github.com/repos/whitlockjc/json-refs/issues/47/events","html_url":"https://github.com/whitlockjc/json-refs/issues/47","id":124304222,"number":47,"title":"Stricter pointer/ref checks & public segment encoding/decoding methods","user":{"login":"brettz9","id":20234,"avatar_url":"https://avatars.githubusercontent.com/u/20234?v=3","gravatar_id":"","url":"https://api.github.com/users/brettz9","html_url":"https://github.com/brettz9","followers_url":"https://api.github.com/users/brettz9/followers","following_url":"https://api.github.com/users/brettz9/following{/other_user}","gists_url":"https://api.github.com/users/brettz9/gists{/gist_id}","starred_url":"https://api.github.com/users/brettz9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettz9/subscriptions","organizations_url":"https://api.github.com/users/brettz9/orgs","repos_url":"https://api.github.com/users/brettz9/repos","events_url":"https://api.github.com/users/brettz9/events{/privacy}","received_events_url":"https://api.github.com/users/brettz9/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":36,"created_at":"2015-12-30T04:57:51Z","updated_at":"2016-01-05T18:17:27Z","closed_at":"2016-01-04T20:53:37Z","body":"Two related issues:\r\n\r\n1. Regarding a proper JSON Reference, the JSON Reference spec states:\r\n\r\n```\r\n If a URI contains a fragment identifier, then the fragment should be\r\n   resolved per the fragment resolution mechansim of the referrant\r\n   document.  If the representation of the referrant document is JSON,\r\n   then the fragment identifier SHOULD be interpreted as a\r\n   [JSON-Pointer].\r\n```\r\n\r\nThe JSON Pointer spec, in turn, says about JSON Pointers:\r\n```\r\n   Since the characters '~' (%x7E) and '/' (%x2F) have a special meaning\r\n   in JSON Pointer, they need to be encoded as '~0' and '~1'\r\n   respectively, when appearing in a reference token.\r\n```\r\n\r\nI would think therefore, that when executing `isPtr` upon encountering any tildes not followed by `0` or `1`, `false` should be given. Similarly when executing `isRef`, especially if we detect that the target document is indeed JSON. This will also have the consequence of potentially throwing for this reason in `pathFromPtr`.\r\n\r\nThe spec seems to make no mention of any requirement to do this, however:\r\n```\r\nEvaluation of each reference token begins by decoding any escaped\r\n   character sequence; this is performed by first transforming any\r\n   occurrence of the sequence '~1' to '/', then transforming any\r\n   occurrence of the sequence '~0' to '~'.\r\n```\r\n\r\n...but I think that when one asks whether something is a pointer or reference, it is good to know whether it has had proper escaping.\r\n\r\n2 .I also think that as the `JsonRefs` tool, you should make the segment encoding and decoding functions public."},"comment":{"url":"https://api.github.com/repos/whitlockjc/json-refs/issues/comments/169086886","html_url":"https://github.com/whitlockjc/json-refs/issues/47#issuecomment-169086886","issue_url":"https://api.github.com/repos/whitlockjc/json-refs/issues/47","id":169086886,"user":{"login":"brettz9","id":20234,"avatar_url":"https://avatars.githubusercontent.com/u/20234?v=3","gravatar_id":"","url":"https://api.github.com/users/brettz9","html_url":"https://github.com/brettz9","followers_url":"https://api.github.com/users/brettz9/followers","following_url":"https://api.github.com/users/brettz9/following{/other_user}","gists_url":"https://api.github.com/users/brettz9/gists{/gist_id}","starred_url":"https://api.github.com/users/brettz9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettz9/subscriptions","organizations_url":"https://api.github.com/users/brettz9/orgs","repos_url":"https://api.github.com/users/brettz9/repos","events_url":"https://api.github.com/users/brettz9/events{/privacy}","received_events_url":"https://api.github.com/users/brettz9/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T18:17:27Z","updated_at":"2016-01-05T18:17:27Z","body":"No, please don't let it hold you back. Thank you for making the functionality possible, btw, and thanks also for being very responsive on all of the feedback/ideas!"}}