{"action":"created","issue":{"url":"https://api.github.com/repos/balderdashy/waterline/issues/1391","repository_url":"https://api.github.com/repos/balderdashy/waterline","labels_url":"https://api.github.com/repos/balderdashy/waterline/issues/1391/labels{/name}","comments_url":"https://api.github.com/repos/balderdashy/waterline/issues/1391/comments","events_url":"https://api.github.com/repos/balderdashy/waterline/issues/1391/events","html_url":"https://github.com/balderdashy/waterline/issues/1391","id":175549748,"number":1391,"title":"1/0 Not Converting to Boolean on Model.Create()","user":{"login":"jvanalst","id":289117,"avatar_url":"https://avatars.githubusercontent.com/u/289117?v=3","gravatar_id":"","url":"https://api.github.com/users/jvanalst","html_url":"https://github.com/jvanalst","followers_url":"https://api.github.com/users/jvanalst/followers","following_url":"https://api.github.com/users/jvanalst/following{/other_user}","gists_url":"https://api.github.com/users/jvanalst/gists{/gist_id}","starred_url":"https://api.github.com/users/jvanalst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvanalst/subscriptions","organizations_url":"https://api.github.com/users/jvanalst/orgs","repos_url":"https://api.github.com/users/jvanalst/repos","events_url":"https://api.github.com/users/jvanalst/events{/privacy}","received_events_url":"https://api.github.com/users/jvanalst/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/balderdashy/waterline/labels/Needs%20cleanup","name":"Needs cleanup","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-07T16:34:19Z","updated_at":"2016-09-07T16:37:16Z","closed_at":null,"body":"<!--\r\n======================================================\r\nHELLO, and welcome to the (experimental) Sailsbot\r\nissue-submission system.  If you encounter any\r\nproblems with this system, please contact\r\nsgress454@treeline.io\r\n\r\nFIRST THINGS FIRST: please fill out the following info \r\n(Don't change text between **) \r\n======================================================\r\n### BEGIN VERSION INFO ###\r\n-->\r\n\r\n**Waterline version**: 0.11.2\r\n**Node version**: v4.5.0\r\n**NPM version**: 2.15.9\r\n**Operating system**: Linux-like (Ubuntu, Mac OS X)\r\n\r\n<!-- \r\n### END VERSION INFO ###\r\n======================================================\r\nGREAT! - Now read carefully \r\n(Sailsbot will know if you don't)!  \r\n======================================================\r\n\r\nBefore you submit an issue for Waterline, please make sure you have read the Sails issue contribution guide (http://bit.ly/sails-issue-guide) carefully, and then verify the following by typing an X in between each set of [ ] brackets below (don't make any other changes to the text!):\r\n\r\n### BEGIN PLEDGE ###\r\n- [ ] I am experiencing a concrete technical issue with Waterline (ideas and feature proposals should follow the guide for proposing features and enhancements (http://bit.ly/sails-feature-guide), which involves making a pull request).  If you're not 100% certain whether it's a bug or not, that's okay--you may continue.  The worst that can happen is that the issue will be closed and we'll point you in the right direction.\r\n\r\n- [ ] I am not asking a question about how to use Waterline or about whether or not Waterline has a certain feature (please refer to the documentation(http://sailsjs.org), or post on http://stackoverflow.com, our Google Group (http://bit.ly/sails-google-group) or our live chat (https://gitter.im/balderdashy/sails).\r\n\r\n- [ ] I have already searched for related issues, and found none open (if you found a related _closed_ issue, please link to it in your post).\r\n\r\n- [ ] My issue title is concise, on-topic and polite.\r\n\r\nand finally...\r\n- [ ] **I can provide steps to reproduce this issue that others can follow.**\r\n\r\nIdeally, this involves creating a new repo that demonstrates the problem (see instructions at http://bit.ly/waterline-issue-repo).  Even though your issue may seem so simple to reproduce that a new repo is unnecessary, you'd be surprised how many solutions present themselves when you start from `sails new` and attempt to recreate your issue from scratch in a new app.  This ensures that the real issue isn't in your user code or in a third-party module.  If you're absolutely _convinced_ that a new repo is unnecessary, provide clear, concise and _specific_ steps to reproduce the problem in your post (not \"create a model then do blueprint create\").\r\n### END PLEDGE ###\r\n\r\nOKAY--THANKS FOR READING!  Continue posting details of your issue below. -->\r\n<hr/>\r\nThis is as much a question as anything else.\r\n\r\nSteps to replicate:\r\n```bash\r\n  sails new boolean-test\r\n  sails generate api boolean\r\n```\r\n\r\n/api/models/Boolean.js :\r\n```js\r\n//boolean.js\r\nmodule.exports = {\r\n\r\n  attributes: {\r\n    test: {\r\n      type: 'boolean',\r\n      required: true\r\n    }\r\n  }\r\n\r\n};\r\n```\r\n\r\nWhen I call a ```model.create()``` and POST a \"1\" or \"0\" representing my boolean it blows up with a WL validation error. It doesn't do the type conversion automatically. \r\n\r\nE.g. ```http://localhost:1337/boolean/create?test=1``` \r\nreturns ``` `undefined` should be a boolean (instead of \"1\", which is a string)```\r\n\r\nBut when I do a ```model.find()``` with a \"1\"/\"0\" it converts to a boolean just fine and finds what I'm looking for.  E.g. ```http://localhost:1337/boolean/?test=1``` returns all the boolean objects where test is true.\r\n\r\nIs this inconsistency intended? Or is it a bug?\r\n"},"comment":{"url":"https://api.github.com/repos/balderdashy/waterline/issues/comments/245341141","html_url":"https://github.com/balderdashy/waterline/issues/1391#issuecomment-245341141","issue_url":"https://api.github.com/repos/balderdashy/waterline/issues/1391","id":245341141,"user":{"login":"jvanalst","id":289117,"avatar_url":"https://avatars.githubusercontent.com/u/289117?v=3","gravatar_id":"","url":"https://api.github.com/users/jvanalst","html_url":"https://github.com/jvanalst","followers_url":"https://api.github.com/users/jvanalst/followers","following_url":"https://api.github.com/users/jvanalst/following{/other_user}","gists_url":"https://api.github.com/users/jvanalst/gists{/gist_id}","starred_url":"https://api.github.com/users/jvanalst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvanalst/subscriptions","organizations_url":"https://api.github.com/users/jvanalst/orgs","repos_url":"https://api.github.com/users/jvanalst/repos","events_url":"https://api.github.com/users/jvanalst/events{/privacy}","received_events_url":"https://api.github.com/users/jvanalst/received_events","type":"User","site_admin":false},"created_at":"2016-09-07T16:37:15Z","updated_at":"2016-09-07T16:37:15Z","body":"@sailsbot fixed?"}}
{"actor":{"display_login":"jvanalst"}}