{"action":"created","issue":{"url":"https://api.github.com/repos/serverless/serverless/issues/463","repository_url":"https://api.github.com/repos/serverless/serverless","labels_url":"https://api.github.com/repos/serverless/serverless/issues/463/labels{/name}","comments_url":"https://api.github.com/repos/serverless/serverless/issues/463/comments","events_url":"https://api.github.com/repos/serverless/serverless/issues/463/events","html_url":"https://github.com/serverless/serverless/issues/463","id":125140594,"number":463,"title":"Question: Is there a reason why we use \"s-function.json\" files instead of a \"js\" file which exports the same json?","user":{"login":"swarajgiri","id":6647345,"avatar_url":"https://avatars.githubusercontent.com/u/6647345?v=3","gravatar_id":"","url":"https://api.github.com/users/swarajgiri","html_url":"https://github.com/swarajgiri","followers_url":"https://api.github.com/users/swarajgiri/followers","following_url":"https://api.github.com/users/swarajgiri/following{/other_user}","gists_url":"https://api.github.com/users/swarajgiri/gists{/gist_id}","starred_url":"https://api.github.com/users/swarajgiri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swarajgiri/subscriptions","organizations_url":"https://api.github.com/users/swarajgiri/orgs","repos_url":"https://api.github.com/users/swarajgiri/repos","events_url":"https://api.github.com/users/swarajgiri/events{/privacy}","received_events_url":"https://api.github.com/users/swarajgiri/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-06T09:23:55Z","updated_at":"2016-04-04T03:20:26Z","closed_at":"2016-04-04T01:53:04Z","body":"Was trying out optional query params for an endpoint and needed a mapping template.\r\nThis is what i started with.\r\n```\r\n\"requestTemplates\": { \"application/json\": \"{\\n\\\"limit\\\": \\\"$input.params('limit') \\\", \\n\\\"position\\\": \\\"$input.params('position') \\\"}\" }\r\n```\r\n\r\nNotice there is a empty space before the ending curly. This caused apigateway to throw up parsing errors, which got resolved when i used\r\n```\r\n{\\n\\\"limit\\\": \\\"$input.params('limit')\\\", \\n\\\"position\\\": \\\"$input.params('position')\\\"\\n}\r\n```\r\n\r\nA simple mapping template resulted in at least 20 mins of head scratching, imagine what would happen if someone required a rather long mapping template.\r\n\r\n#### Suggestion:\r\nWe would be in a better position if we used a `s-function.js` file and export the required config out. This would help anyone writing a non-trivial mapping template. "},"comment":{"url":"https://api.github.com/repos/serverless/serverless/issues/comments/205116517","html_url":"https://github.com/serverless/serverless/issues/463#issuecomment-205116517","issue_url":"https://api.github.com/repos/serverless/serverless/issues/463","id":205116517,"user":{"login":"swarajgiri","id":6647345,"avatar_url":"https://avatars.githubusercontent.com/u/6647345?v=3","gravatar_id":"","url":"https://api.github.com/users/swarajgiri","html_url":"https://github.com/swarajgiri","followers_url":"https://api.github.com/users/swarajgiri/followers","following_url":"https://api.github.com/users/swarajgiri/following{/other_user}","gists_url":"https://api.github.com/users/swarajgiri/gists{/gist_id}","starred_url":"https://api.github.com/users/swarajgiri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swarajgiri/subscriptions","organizations_url":"https://api.github.com/users/swarajgiri/orgs","repos_url":"https://api.github.com/users/swarajgiri/repos","events_url":"https://api.github.com/users/swarajgiri/events{/privacy}","received_events_url":"https://api.github.com/users/swarajgiri/received_events","type":"User","site_admin":false},"created_at":"2016-04-04T03:20:26Z","updated_at":"2016-04-04T03:20:26Z","body":"@eahefnawy - Why was this closed?"}}