mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-19 04:59:15 +00:00
projectName support to fill package.json template
Inspired by ClojureClientCodegen.java, it is interesting to use projectName from info.title swagger spec to fill up package.json name attribute
This commit is contained in:
committed by
Francois LE QUEMENER
parent
170bde65e5
commit
4f715342a1
@@ -259,6 +259,16 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig
|
||||
}
|
||||
}
|
||||
this.additionalProperties.put("serverPort", port);
|
||||
|
||||
if (swagger.getInfo() != null) {
|
||||
Info info = swagger.getInfo();
|
||||
if (projectName == null && info.getTitle() != null) {
|
||||
// when projectName is not specified, generate it from info.title
|
||||
//used in package.json
|
||||
projectName = dashize(info.getTitle());
|
||||
this.additionalProperties.put("projectName", projectName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user