Skip to content

Commit

Permalink
Merge pull request #1833 from frinux/patch-1
Browse files Browse the repository at this point in the history
projectName support to fill package.json template
  • Loading branch information
wing328 committed Jan 11, 2016
2 parents 391eb1b + 15676ff commit 3c48202
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import io.swagger.codegen.*;
import io.swagger.models.Swagger;
import io.swagger.models.Info;
import io.swagger.util.Yaml;

import java.io.File;
Expand Down Expand Up @@ -256,6 +257,16 @@ public void preprocessSwagger(Swagger swagger) {
}
}
this.additionalProperties.put("serverPort", port);

if (swagger.getInfo() != null) {
Info info = swagger.getInfo();
if (info.getTitle() != null) {
// when info.title is defined, use it for projectName
// used in package.json
projectName = dashize(info.getTitle());
this.additionalProperties.put("projectName", projectName);
}
}
}

@Override
Expand Down

0 comments on commit 3c48202

Please sign in to comment.