Skip to content

Commit

Permalink
Strip out the UTF-BOM character if present
Browse files Browse the repository at this point in the history
Fixes #17
  • Loading branch information
Luis Fernando Planella Gonzalez committed Nov 30, 2017
1 parent 3723795 commit 34f45a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ng-swagger-gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ function doGenerate(swaggerContent, options) {
var templates = options.templates;
var output = options.output || 'src/app/api';

// Strip out the UTF-BOM if present
swaggerContent = swaggerContent.replace(/^\uFEFF/, '');

// Proceed with the JSON parsing
var swagger = JSON.parse(swaggerContent);
if (typeof swagger != 'object') {
console.error("Invalid swagger content");
Expand Down

0 comments on commit 34f45a4

Please sign in to comment.