{"action":"created","issue":{"url":"https://api.github.com/repos/fedwiki/wiki-plugin-transport/issues/1","repository_url":"https://api.github.com/repos/fedwiki/wiki-plugin-transport","labels_url":"https://api.github.com/repos/fedwiki/wiki-plugin-transport/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/fedwiki/wiki-plugin-transport/issues/1/comments","events_url":"https://api.github.com/repos/fedwiki/wiki-plugin-transport/issues/1/events","html_url":"https://github.com/fedwiki/wiki-plugin-transport/issues/1","id":98632570,"number":1,"title":"Validate and correct json from remote sites.","user":{"login":"WardCunningham","id":12127,"avatar_url":"https://avatars.githubusercontent.com/u/12127?v=3","gravatar_id":"","url":"https://api.github.com/users/WardCunningham","html_url":"https://github.com/WardCunningham","followers_url":"https://api.github.com/users/WardCunningham/followers","following_url":"https://api.github.com/users/WardCunningham/following{/other_user}","gists_url":"https://api.github.com/users/WardCunningham/gists{/gist_id}","starred_url":"https://api.github.com/users/WardCunningham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WardCunningham/subscriptions","organizations_url":"https://api.github.com/users/WardCunningham/orgs","repos_url":"https://api.github.com/users/WardCunningham/repos","events_url":"https://api.github.com/users/WardCunningham/events{/privacy}","received_events_url":"https://api.github.com/users/WardCunningham/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2015-08-02T19:59:28Z","updated_at":"2016-07-04T23:06:57Z","closed_at":"2016-07-04T23:06:57Z","body":"Wiki tries to be accommodating of whatever json it finds as it browses the federation. In this spirit it makes `{}` a valid page by providing missing fields. But this may not be helpful for someone writing an external service that is attempting to provide good content. We should write and maintain a wiki json validator similar to html tidy. This could be incorporated into the Transporter (or anywhere json is fetched) as follows.\r\n\r\n* Apply the validator to page json text.\r\n* Be assured that a valid object version would be returned.\r\n* Receive a list of accommodations that have been applied.\r\n* Possibly insert a paragraph summarizing these adjustments before rendering the page.\r\n\r\nI will suggest checks to make and sometimes accommodations that might be appropriate. We welcome suggestions in comments to this issue.\r\n\r\n### Checks\r\n\r\nIs the text valid json? It might be sufficient to catch a failed JSON.parse() but a more tolerant parser might return the successfully parsed prefix of the text.\r\n\r\nIs the parsed json an object? An array could be treated as a story, a string as a paragraph, numbers, true, false and nil could be treated as strings.\r\n\r\nDoes the object have a title, story and journal? If not, create empty versions of each.\r\n\r\nDo the items of the story have types that name plugins available on this server? The call to the validator could provide the list from /system/plugins.json. If not, passing the unexpected type is ok because this is handled by plugin lookup.\r\n\r\nDo the items of the story have unique ids? If not unique, generate aliases. If not present, generate ids at random.\r\n\r\nDo items have text that makes sense for the item type?\r\n\r\nDo items have text of reasonable length? If not, consider truncating it.\r\n\r\nDo items have text with square brackets that balance as links?\r\n\r\nDo html items have tags that won't sanitize?\r\n\r\nDo image items have pictures that are of reasonable size?\r\n\r\nDo video items have captions that allow them to be edited?\r\n\r\nDo items have text with British spellings of familiar words like color or neighbor? (just kidding)\r\n\r\nDo the actions of journal have types that can be understood by lib/revision? Do they have expected parameters?\r\n\r\nDo the actions have ids that match included items?\r\n\r\nDo the actions have dates? If not, infer dates from surrounding actions or use the date that dating actions began.\r\n\r\nDo add actions that are positioned after items in the page that can be found?\r\n\r\nDo the actions recreate the story?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/fedwiki/wiki-plugin-transport/issues/comments/230362289","html_url":"https://github.com/fedwiki/wiki-plugin-transport/issues/1#issuecomment-230362289","issue_url":"https://api.github.com/repos/fedwiki/wiki-plugin-transport/issues/1","id":230362289,"user":{"login":"WardCunningham","id":12127,"avatar_url":"https://avatars.githubusercontent.com/u/12127?v=3","gravatar_id":"","url":"https://api.github.com/users/WardCunningham","html_url":"https://github.com/WardCunningham","followers_url":"https://api.github.com/users/WardCunningham/followers","following_url":"https://api.github.com/users/WardCunningham/following{/other_user}","gists_url":"https://api.github.com/users/WardCunningham/gists{/gist_id}","starred_url":"https://api.github.com/users/WardCunningham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WardCunningham/subscriptions","organizations_url":"https://api.github.com/users/WardCunningham/orgs","repos_url":"https://api.github.com/users/WardCunningham/repos","events_url":"https://api.github.com/users/WardCunningham/events{/privacy}","received_events_url":"https://api.github.com/users/WardCunningham/received_events","type":"User","site_admin":false},"created_at":"2016-07-04T23:06:57Z","updated_at":"2016-07-04T23:06:57Z","body":"This issue suggested extensive validation of json returned from suspicious transporters. With no action for 11 months I judge this not likely to happen. Perhaps this means our transporters are good enough. \r\n\r\nFurther discussion revolved around the burden of CORS. I consider this too a fact of life that is not likely to change. For these reasons I will close this issue with no further action."}}
{"actor":{"display_login":"WardCunningham"}}