{"action":"opened","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-codegen/issues/7856","repository_url":"https://api.github.com/repos/swagger-api/swagger-codegen","labels_url":"https://api.github.com/repos/swagger-api/swagger-codegen/issues/7856/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-codegen/issues/7856/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-codegen/issues/7856/events","html_url":"https://github.com/swagger-api/swagger-codegen/issues/7856","id":306052955,"number":7856,"title":"typescript-fetch fails on BOM (may be wider issue than this template)","user":{"login":"jesomm","id":29990869,"avatar_url":"https://avatars0.githubusercontent.com/u/29990869?v=4","gravatar_id":"","url":"https://api.github.com/users/jesomm","html_url":"https://github.com/jesomm","followers_url":"https://api.github.com/users/jesomm/followers","following_url":"https://api.github.com/users/jesomm/following{/other_user}","gists_url":"https://api.github.com/users/jesomm/gists{/gist_id}","starred_url":"https://api.github.com/users/jesomm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jesomm/subscriptions","organizations_url":"https://api.github.com/users/jesomm/orgs","repos_url":"https://api.github.com/users/jesomm/repos","events_url":"https://api.github.com/users/jesomm/events{/privacy}","received_events_url":"https://api.github.com/users/jesomm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-16T19:37:59Z","updated_at":"2018-03-16T19:37:59Z","closed_at":null,"author_association":"NONE","body":"##### Description\r\n\r\ntypescript-fetch codegen is failing on BOM (`0xfeff` in error below)\r\n\r\n```\r\n[main] ERROR io.swagger.parser.SwaggerCompatConverter - failed to read resource listing\r\ncom.fasterxml.jackson.core.JsonParseException: Unexpected character ('?' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\r\n at [Source: java.io.StringReader@3570b7; line: 1, column: 2]\r\n\tat com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702)\r\n\tat com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558)\r\n\tat com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:456)\r\n\tat com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1906)\r\n\tat com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:749)\r\n\tat com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3850)\r\n\tat com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3799)\r\n\tat com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2397)\r\n\tat io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:187)\r\n\tat io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:116)\r\n\tat io.swagger.parser.SwaggerParser.read(SwaggerParser.java:75)\r\n\tat io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:431)\r\n\tat io.swagger.codegen.cmd.Generate.run(Generate.java:283)\r\n\tat io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)\r\nException in thread \"main\" java.lang.RuntimeException: missing swagger input or config!\r\n\tat io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:731)\r\n\tat io.swagger.codegen.cmd.Generate.run(Generate.java:285)\r\n\tat io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)\r\n```\r\n\r\n##### Swagger-codegen version\r\n\r\n2.3.1\r\n\r\n##### Swagger declaration file content or url\r\n\r\nrepros with any otherwise valid swagger content returned by server using BOM\r\n\r\n##### Command line used for generation\r\n\r\ncall command:\r\n`java -jar <path/to/swagger-codegen> generate -i <path/to/swaggerJson> -l typescript-fetch -t <path/to/templates> -c <path/to/config> -o <path/to/desired/output>`\r\n\r\nwhich we trigger from npm script that actually defines all those paths:\r\n```\r\nconst execSync = require('child_process').execSync;\r\n// code that generates paths and assigns above command to var execString\r\nexecSync(execString, { stdio: ['ignore', 'ignore', stdErr] });\r\n```\r\n\r\nconfig:\r\n```\r\n{\r\n    \"allowUnicodeIdentifiers\" : false,\r\n    \"ensureUniqueParams\": true,\r\n    \"modelPropertyNaming\": \"camelCase\",\r\n    \"sortParamsByRequiredFlag\": true,\r\n    \"supportsES6\" : false\r\n}\r\n```\r\n\r\n##### Steps to reproduce\r\n\r\nrepros every time on using a swagger.json returned by a server that sends BOM\r\n\r\n##### Related issues/PRs\r\n\r\nhttps://github.com/swagger-api/swagger-codegen/issues/6971, https://github.com/swagger-api/swagger-codegen/issues/3680\r\n\r\n##### Suggest a fix/enhancement\r\n\r\nstrip BOM before trying to parse JSON?\r\n\r\nsomething like this could be used / forked and rewritten for java/swagger:\r\n- https://github.com/sindresorhus?utf8=✓&tab=repositories&q=strip-bom\r\n\r\n"}}
{"actor":{"display_login":"jesomm"}}