{"action":"created","issue":{"url":"https://api.github.com/repos/apiaryio/mson/issues/26","labels_url":"https://api.github.com/repos/apiaryio/mson/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/apiaryio/mson/issues/26/comments","events_url":"https://api.github.com/repos/apiaryio/mson/issues/26/events","html_url":"https://github.com/apiaryio/mson/issues/26","id":80937581,"number":26,"title":"Null primitive type","user":{"login":"netmilk","id":79609,"avatar_url":"https://avatars.githubusercontent.com/u/79609?v=3","gravatar_id":"","url":"https://api.github.com/users/netmilk","html_url":"https://github.com/netmilk","followers_url":"https://api.github.com/users/netmilk/followers","following_url":"https://api.github.com/users/netmilk/following{/other_user}","gists_url":"https://api.github.com/users/netmilk/gists{/gist_id}","starred_url":"https://api.github.com/users/netmilk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netmilk/subscriptions","organizations_url":"https://api.github.com/users/netmilk/orgs","repos_url":"https://api.github.com/users/netmilk/repos","events_url":"https://api.github.com/users/netmilk/events{/privacy}","received_events_url":"https://api.github.com/users/netmilk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/apiaryio/mson/labels/t3:%20discussion","name":"t3: discussion","color":"E10288"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":122,"created_at":"2015-05-26T12:20:34Z","updated_at":"2015-08-27T13:43:26Z","closed_at":null,"body":"In [this Dredd issue](https://github.com/apiaryio/dredd/issues/194) is @neonichu having a body JSON key with `null` value. There is no way how to express it in MSON at this moment. Can you please add support for  `null` primitive type in MSON?"},"comment":{"url":"https://api.github.com/repos/apiaryio/mson/issues/comments/135435209","html_url":"https://github.com/apiaryio/mson/issues/26#issuecomment-135435209","issue_url":"https://api.github.com/repos/apiaryio/mson/issues/26","id":135435209,"user":{"login":"zdne","id":613617,"avatar_url":"https://avatars.githubusercontent.com/u/613617?v=3","gravatar_id":"","url":"https://api.github.com/users/zdne","html_url":"https://github.com/zdne","followers_url":"https://api.github.com/users/zdne/followers","following_url":"https://api.github.com/users/zdne/following{/other_user}","gists_url":"https://api.github.com/users/zdne/gists{/gist_id}","starred_url":"https://api.github.com/users/zdne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdne/subscriptions","organizations_url":"https://api.github.com/users/zdne/orgs","repos_url":"https://api.github.com/users/zdne/repos","events_url":"https://api.github.com/users/zdne/events{/privacy}","received_events_url":"https://api.github.com/users/zdne/received_events","type":"User","site_admin":false},"created_at":"2015-08-27T13:43:26Z","updated_at":"2015-08-27T13:43:26Z","body":"So I have a little bit formalized @pksunkara 's proposal into following: \r\n\r\n## Proposed solution\r\n\r\nIntroduce a new *type attribute* `nullable`. This attributes will indicate a *value* of this *type* MAY be unset (e.g. `null` or `nil`). \r\n\r\nThis will alter the section [3.5.3 Type Attribute](https://github.com/apiaryio/mson/blob/master/MSON%20Specification.md#353-type-attribute) of MSON specification by adding:\r\n\r\n- `nullable` – instance of this type *Value* MAY be unset. \r\n\r\n\r\n\r\nNOTE: By default, an instance of type SHOULD NOT be unset (`null`, `nil`)\r\n\r\n## Rendering recommendation\r\n\r\nThese are the recommendation for rendering **an instance of a `nullable` type without any other sample value provided**.\r\n\r\n#### JavaScript, JSON, YAML\r\n\r\n`null` value\r\n\r\n#### JSON Schema\r\n\r\n`{ \"type\": [ \"string\", \"null\" ] }`\r\n\r\n(instance of a `nullable` `string` type)\r\n\r\n### XML\r\n\r\n`xsi:nil=\"true\"` attribute\r\n\r\n### Swift, GO\r\n\r\n`nil` value\r\n\r\n### C++, C, PHP, SQL\r\n\r\n`NULL` value\r\n\r\n### Python\r\n\r\n`None` value\r\n\r\n### Ruby\r\n\r\n`nil` value\r\n\r\n### PERL\r\n\r\n`undef` value\r\n\r\n## Rendering with other type attributes\r\n\r\n### `optional` \r\n\r\n```\r\n- key (string, optional)\r\n```\r\n\r\nThe instance of `key` will be **omitted** in the rendered JSON:\r\n\r\n```\r\n{}\r\n```\r\n\r\n### `optional, nullable` \r\n\r\n```\r\n- key (string, optional, nullable)\r\n```\r\n\r\nThe value of the instance will be **unset** in the rendered JSON:\r\n\r\n```\r\n{\r\n  \"key\": null\r\n}\r\n```\r\n\r\n### `required` \r\n\r\n```\r\n- key (string, required)\r\n```\r\n\r\nThe value of instance will be **empty** in the rendered JSON:\r\n\r\n```\r\n{\r\n  \"key\": \"\"\r\n}\r\n```\r\n\r\n### `required, nullable` \r\n\r\n```\r\n- key (string, required, nullable)\r\n```\r\n\r\nThe value of instance of `key` will be **unset** in the rendered JSON:\r\n\r\n```\r\n{\r\n  \"key\": null\r\n}\r\n```\r\n\r\n"}}