{"action":"created","issue":{"url":"https://api.github.com/repos/raml-org/raml-parser-toolbelt/issues/44","repository_url":"https://api.github.com/repos/raml-org/raml-parser-toolbelt","labels_url":"https://api.github.com/repos/raml-org/raml-parser-toolbelt/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/raml-org/raml-parser-toolbelt/issues/44/comments","events_url":"https://api.github.com/repos/raml-org/raml-parser-toolbelt/issues/44/events","html_url":"https://github.com/raml-org/raml-parser-toolbelt/issues/44","id":190808381,"number":44,"title":"Issue with expansion of required properties","user":{"login":"jstoiko","id":9660342,"avatar_url":"https://avatars.githubusercontent.com/u/9660342?v=3","gravatar_id":"","url":"https://api.github.com/users/jstoiko","html_url":"https://github.com/jstoiko","followers_url":"https://api.github.com/users/jstoiko/followers","following_url":"https://api.github.com/users/jstoiko/following{/other_user}","gists_url":"https://api.github.com/users/jstoiko/gists{/gist_id}","starred_url":"https://api.github.com/users/jstoiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jstoiko/subscriptions","organizations_url":"https://api.github.com/users/jstoiko/orgs","repos_url":"https://api.github.com/users/jstoiko/repos","events_url":"https://api.github.com/users/jstoiko/events{/privacy}","received_events_url":"https://api.github.com/users/jstoiko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-21T19:10:45Z","updated_at":"2016-11-24T09:31:24Z","closed_at":null,"body":"The following does not expand for some reason.\r\n\r\n```raml\r\n#%RAML 1.0\r\ntitle: Person API\r\n\r\ntypes:\r\n  Address:\r\n    type: object\r\n    properties:\r\n      street:\r\n        type: string\r\n  Person:\r\n    type: object\r\n    properties:\r\n      home_address:\r\n        type: Address\r\n      work_address:\r\n        type: Address\r\n        required: false\r\n\r\n\r\n/humans:\r\n  post:\r\n    body:\r\n      application/json:\r\n        type: Person\r\n```\r\n\r\nIt trows the error: `Error in required property, making optional base class required property`\r\n\r\nnote: it works when removing the `work_address` property"},"comment":{"url":"https://api.github.com/repos/raml-org/raml-parser-toolbelt/issues/comments/262729963","html_url":"https://github.com/raml-org/raml-parser-toolbelt/issues/44#issuecomment-262729963","issue_url":"https://api.github.com/repos/raml-org/raml-parser-toolbelt/issues/44","id":262729963,"user":{"login":"antoniogarrote","id":8277,"avatar_url":"https://avatars.githubusercontent.com/u/8277?v=3","gravatar_id":"","url":"https://api.github.com/users/antoniogarrote","html_url":"https://github.com/antoniogarrote","followers_url":"https://api.github.com/users/antoniogarrote/followers","following_url":"https://api.github.com/users/antoniogarrote/following{/other_user}","gists_url":"https://api.github.com/users/antoniogarrote/gists{/gist_id}","starred_url":"https://api.github.com/users/antoniogarrote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoniogarrote/subscriptions","organizations_url":"https://api.github.com/users/antoniogarrote/orgs","repos_url":"https://api.github.com/users/antoniogarrote/repos","events_url":"https://api.github.com/users/antoniogarrote/events{/privacy}","received_events_url":"https://api.github.com/users/antoniogarrote/received_events","type":"User","site_admin":false},"created_at":"2016-11-24T09:31:24Z","updated_at":"2016-11-24T09:31:24Z","body":"Ok, got it. I was getting confused by the value of `name` and `defaultName`. \r\nSorry about that.\r\n\r\nThe problem is that `Address` is marked explicitly as `required: true` while the type you are trying to expand, inheriting from `Address`, is setting it to `required: false`.\r\n\r\nThe canonical form is computing inheritance using set-inclusion semantics. The instances of the sub-type have to be a proper subset of the instances of the super-type. The instances of not required Addresses cannot be a subset of required Addresses. That is what the error message is saying.\r\n\r\nYou can remove the `required` facet from Address, make it `required: false`, or mark the sub-type as `required: true` and it will work."}}
{"actor":{"display_login":"antoniogarrote"}}