{"action":"created","issue":{"url":"https://api.github.com/repos/wvteijlingen/Spine/issues/139","repository_url":"https://api.github.com/repos/wvteijlingen/Spine","labels_url":"https://api.github.com/repos/wvteijlingen/Spine/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/wvteijlingen/Spine/issues/139/comments","events_url":"https://api.github.com/repos/wvteijlingen/Spine/issues/139/events","html_url":"https://github.com/wvteijlingen/Spine/issues/139","id":192904449,"number":139,"title":"NSUnknownKeyException when trying to serialize Boolean attributes","user":{"login":"grahammccarthy","id":1336930,"avatar_url":"https://avatars.githubusercontent.com/u/1336930?v=3","gravatar_id":"","url":"https://api.github.com/users/grahammccarthy","html_url":"https://github.com/grahammccarthy","followers_url":"https://api.github.com/users/grahammccarthy/followers","following_url":"https://api.github.com/users/grahammccarthy/following{/other_user}","gists_url":"https://api.github.com/users/grahammccarthy/gists{/gist_id}","starred_url":"https://api.github.com/users/grahammccarthy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grahammccarthy/subscriptions","organizations_url":"https://api.github.com/users/grahammccarthy/orgs","repos_url":"https://api.github.com/users/grahammccarthy/repos","events_url":"https://api.github.com/users/grahammccarthy/events{/privacy}","received_events_url":"https://api.github.com/users/grahammccarthy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-01T17:02:11Z","updated_at":"2016-12-08T22:05:30Z","closed_at":"2016-12-08T22:05:30Z","body":"I get a very consistent error when trying to capture Boolean attributes in my Resource\r\n\r\nAll of my boolean attributes from the API start with 'is-'. \r\n\r\nI've tried to use BooleanAttribute(), and Attribute() and both return the same error. I've also tried to store the value as String, Int, Bool.\r\n\r\nI'm on the latest version of Spine.\r\n\r\nERROR:\r\n```\r\n*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<APP.Item 0x60800019eb90> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key isRead.'\r\n```\r\n\r\nExample GET /items/2\r\n```json\r\n{\r\n  \"data\": {\r\n    \"type\": \"items\",\r\n    \"id\": \"2\",\r\n    \"attributes\": {\r\n      \"title\": \"This is the title of my item\",\r\n      \"body\": \"This is a body of my item\",\r\n      \"is-discussed\": false,\r\n      \"is-read\": true,\r\n      \"created-at\": \"2016-11-24 22:07:07\",\r\n      \"updated-at\": \"2016-11-24 22:07:07\"\r\n    },\r\n    \"links\": {\r\n      \"self\": \"https://myappurl.com/items/2\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nMY RESOURCE MODEL:\r\n```swift\r\nimport Foundation\r\nimport Spine\r\n\r\nclass Item: Resource {\r\n    \r\n    var type : String?\r\n    var title : String?\r\n    //var isDiscussed : Bool?\r\n    var isRead : Bool?\r\n    var createdAt : Date?\r\n    var updatedAt : Date?\r\n    var author : User?\r\n    \r\n    override class var resourceType: ResourceType {\r\n        return \"items\"\r\n    }\r\n    \r\n    override class var fields: [Field] {\r\n        return fieldsFromDictionary([\r\n            \"type\": Attribute(),\r\n            \"title\": Attribute(),\r\n            //\"isDiscussed\": BooleanAttribute().serializeAs(\"is-discussed\"),\r\n            \"isRead\": BooleanAttribute().serializeAs(\"is-read\"),\r\n            \"createdAt\": DateAttribute(format:DATE_API_FORMAT).serializeAs(\"created-at\"),\r\n            \"updatedAt\": DateAttribute(format:DATE_API_FORMAT).serializeAs(\"updated-at\"),\r\n            \"author\": ToOneRelationship(User.self)\r\n        ])\r\n    }\r\n}\r\n```\r\n\r\nAny help would be greatly appreciated!\r\n\r\nThanks,\r\nGraham."},"comment":{"url":"https://api.github.com/repos/wvteijlingen/Spine/issues/comments/265869771","html_url":"https://github.com/wvteijlingen/Spine/issues/139#issuecomment-265869771","issue_url":"https://api.github.com/repos/wvteijlingen/Spine/issues/139","id":265869771,"user":{"login":"grahammccarthy","id":1336930,"avatar_url":"https://avatars.githubusercontent.com/u/1336930?v=3","gravatar_id":"","url":"https://api.github.com/users/grahammccarthy","html_url":"https://github.com/grahammccarthy","followers_url":"https://api.github.com/users/grahammccarthy/followers","following_url":"https://api.github.com/users/grahammccarthy/following{/other_user}","gists_url":"https://api.github.com/users/grahammccarthy/gists{/gist_id}","starred_url":"https://api.github.com/users/grahammccarthy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grahammccarthy/subscriptions","organizations_url":"https://api.github.com/users/grahammccarthy/orgs","repos_url":"https://api.github.com/users/grahammccarthy/repos","events_url":"https://api.github.com/users/grahammccarthy/events{/privacy}","received_events_url":"https://api.github.com/users/grahammccarthy/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T22:05:30Z","updated_at":"2016-12-08T22:05:30Z","body":"Thanks! That worked like a charm!"}}
{"actor":{"display_login":"grahammccarthy"}}