From ea90ee2ca4c127cbc0c2f827a94eb0c5724f3990 Mon Sep 17 00:00:00 2001 From: Santosh Aherkar Date: Wed, 17 Apr 2019 16:13:11 -0400 Subject: [PATCH] API-86: generate eclipse files based on the config flag --- config.json | 39 +++++++++++++++++++ .../codegen/rest/OpenApiGenerator.java | 8 ++-- .../codegen/rest/SwaggerGenerator.java | 8 ++-- pom.xml | 14 +++++++ 4 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 config.json diff --git a/config.json b/config.json new file mode 100644 index 000000000..e557effc2 --- /dev/null +++ b/config.json @@ -0,0 +1,39 @@ +{ + "name": "api-customers", + "version": "1.0.0", + "groupId": "com.cibc.api", + "artifactId": "api-customers", + "rootPackage": "com.cibc.apif.customers", + "handlerPackage":"com.cibc.apif.customers.handler", + "modelPackage":"com.cibc.apif.customers.model", + "overwriteHandler": false, + "overwriteHandlerTest": false, + "overwriteModel": true, + "httpPort": 8080, + "enableHttp": false, + "httpsPort": 9443, + "enableHttps": true, + "enableRegistry": false, + "eclipseIDE": false, + "supportDb": false, + "dbInfo": { + "name": "mysql", + "driverClassName": "com.mysql.jdbc.Driver", + "jdbcUrl": "jdbc:mysql://mysqldb:3306/oauth2?useSSL=false", + "username": "root", + "password": "my-secret-pw" + }, + "supportH2ForTest": false, + "supportClient": true, + "dockerOrganization": "cibc-api", + "generateEnvVars": { + "generate": true, + "skipArray": true, + "skipMap": true, + "exclude": [ + "service.yml", + "handerl.yml", + "values.yml" + ] + } +} diff --git a/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiGenerator.java b/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiGenerator.java index 2efba35fd..5c40292ea 100644 --- a/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiGenerator.java +++ b/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiGenerator.java @@ -108,6 +108,7 @@ public void generate(final String targetPath, Object model, Any config) throws I String httpsPort = config.toString("httpsPort").trim(); boolean enableRegistry = config.toBoolean("enableRegistry"); + boolean eclipseIDE = config.toBoolean("eclipseIDE"); boolean supportClient = config.toBoolean("supportClient"); String dockerOrganization = config.toString("dockerOrganization").trim(); @@ -152,9 +153,10 @@ public void generate(final String targetPath, Object model, Any config) throws I transfer(targetPath, "", ".gitignore", templates.rest.gitignore.template()); transfer(targetPath, "", "README.md", templates.rest.README.template()); transfer(targetPath, "", "LICENSE", templates.rest.LICENSE.template()); - transfer(targetPath, "", ".classpath", templates.rest.classpath.template()); - transfer(targetPath, "", ".project", templates.rest.project.template(config)); - + if(eclipseIDE) { + transfer(targetPath, "", ".classpath", templates.rest.classpath.template()); + transfer(targetPath, "", ".project", templates.rest.project.template(config)); + } // config transfer(targetPath, ("src.main.resources.config").replace(".", separator), "service.yml", templates.rest.openapi.service.template(config)); diff --git a/light-rest-4j/src/main/java/com/networknt/codegen/rest/SwaggerGenerator.java b/light-rest-4j/src/main/java/com/networknt/codegen/rest/SwaggerGenerator.java index 94ab2eed3..f726e53a7 100644 --- a/light-rest-4j/src/main/java/com/networknt/codegen/rest/SwaggerGenerator.java +++ b/light-rest-4j/src/main/java/com/networknt/codegen/rest/SwaggerGenerator.java @@ -83,6 +83,7 @@ public void generate(String targetPath, Object model, Any config) throws IOExcep boolean enableHttps = config.toBoolean("enableHttps"); String httpsPort = config.toString("httpsPort"); boolean enableRegistry = config.toBoolean("enableRegistry"); + boolean eclipseIDE = config.toBoolean("eclipseIDE"); boolean supportClient = config.toBoolean("supportClient"); String dockerOrganization = config.toString("dockerOrganization"); prometheusMetrics = config.toBoolean("prometheusMetrics"); @@ -111,9 +112,10 @@ public void generate(String targetPath, Object model, Any config) throws IOExcep transfer(targetPath, "", ".gitignore", templates.rest.gitignore.template()); transfer(targetPath, "", "README.md", templates.rest.README.template()); transfer(targetPath, "", "LICENSE", templates.rest.LICENSE.template()); - transfer(targetPath, "", ".classpath", templates.rest.classpath.template()); - transfer(targetPath, "", ".project", templates.rest.project.template(config)); - + if(eclipseIDE) { + transfer(targetPath, "", ".classpath", templates.rest.classpath.template()); + transfer(targetPath, "", ".project", templates.rest.project.template(config)); + } // config transfer(targetPath, ("src.main.resources.config").replace(".", separator), "service.yml", templates.rest.swagger.service.template(config)); diff --git a/pom.xml b/pom.xml index 0e021b506..50dcc562d 100644 --- a/pom.xml +++ b/pom.xml @@ -502,6 +502,20 @@ + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + codelds + https://code.lds.org/nexus/content/groups/main-repo + + +