diff --git a/CHANGELOG.md b/CHANGELOG.md
index 627451528..52e5cacbf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,52 @@
# Change Log
+## [2.3.1](https://github.com/networknt/light-codegen/tree/2.3.1) (2025-09-19)
+
+
+**Merged pull requests:**
+
+
+
+
+## [2.3.0](https://github.com/networknt/light-codegen/tree/2.3.0) (2025-06-25)
+
+
+**Merged pull requests:**
+
+
+
+
+## [2.2.2](https://github.com/networknt/light-codegen/tree/2.2.2) (2025-06-05)
+
+
+**Merged pull requests:**
+
+
+
+
+## [2.2.1](https://github.com/networknt/light-codegen/tree/2.2.1) (2025-03-22)
+
+
+**Merged pull requests:**
+
+
+
+
+## [2.2.0](https://github.com/networknt/light-codegen/tree/2.2.0) (2025-02-12)
+
+
+**Merged pull requests:**
+
+
+- fixes \#710 update rest and hybrid generator [\#711](https://github.com/networknt/light-codegen/pull/711) ([stevehu](https://github.com/stevehu))
+
+
+## [2.1.37](https://github.com/networknt/light-codegen/tree/2.1.37) (2024-09-20)
+
+
+**Merged pull requests:**
+
+
## [2.1.36](https://github.com/networknt/light-codegen/tree/2.1.36) (2024-08-27)
diff --git a/LICENSE b/LICENSE
index 8dada3eda..d26ed5e27 100644
--- a/LICENSE
+++ b/LICENSE
@@ -178,7 +178,7 @@
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
+ boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright {yyyy} {name of copyright owner}
+ Copyright {yyyy} [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/codegen-cli/pom.xml b/codegen-cli/pom.xml
index 8a91657b9..940db73a3 100644
--- a/codegen-cli/pom.xml
+++ b/codegen-cli/pom.xml
@@ -21,12 +21,13 @@
com.networknt
light-codegen
- 2.1.36
+ 2.3.2-SNAPSHOT
../pom.xml
codegen-cli
jar
+ codegen-cli
light-generator cli.
diff --git a/codegen-core/pom.xml b/codegen-core/pom.xml
index 2a2d146a2..3993df4bf 100644
--- a/codegen-core/pom.xml
+++ b/codegen-core/pom.xml
@@ -21,12 +21,13 @@
com.networknt
light-codegen
- 2.1.36
+ 2.3.2-SNAPSHOT
../pom.xml
codegen-core
jar
+ codegen-core
light generator core.
diff --git a/codegen-fwk/pom.xml b/codegen-fwk/pom.xml
index 5f951982a..096e5e535 100644
--- a/codegen-fwk/pom.xml
+++ b/codegen-fwk/pom.xml
@@ -21,12 +21,13 @@
com.networknt
light-codegen
- 2.1.36
+ 2.3.2-SNAPSHOT
../pom.xml
codegen-fwk
jar
+ codegen-fwk
light-generator framework.
diff --git a/codegen-web/pom.xml b/codegen-web/pom.xml
index 22d278cd9..7e60fcc4f 100644
--- a/codegen-web/pom.xml
+++ b/codegen-web/pom.xml
@@ -21,12 +21,13 @@
com.networknt
light-codegen
- 2.1.36
+ 2.3.2-SNAPSHOT
../pom.xml
codegen-web
jar
+ codegen-web
light-generator cli.
diff --git a/codegen-web/src/main/java/com/networknt/codegen/handler/CodegenMultipleHandler.java b/codegen-web/src/main/java/com/networknt/codegen/handler/CodegenMultipleHandler.java
index 09c6b6ddb..fcd10acac 100644
--- a/codegen-web/src/main/java/com/networknt/codegen/handler/CodegenMultipleHandler.java
+++ b/codegen-web/src/main/java/com/networknt/codegen/handler/CodegenMultipleHandler.java
@@ -13,6 +13,7 @@
import com.networknt.rpc.router.ServiceHandler;
import com.networknt.utility.HashUtil;
import com.networknt.utility.NioUtils;
+import com.networknt.utility.UuidUtil;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.HttpString;
import org.slf4j.Logger;
@@ -55,7 +56,7 @@ public class CodegenMultipleHandler implements HybridHandler {
@Override
public ByteBuffer handle(HttpServerExchange exchange, Object input) {
// generate a destination folder name.
- String output = HashUtil.generateUUID();
+ String output = UuidUtil.uuidToBase64(UuidUtil.getUUID());
String zipFile = output + ".zip";
String projectFolder = codegenWebConfig.getTmpFolder() + separator + output;
diff --git a/codegen-web/src/main/java/com/networknt/codegen/handler/CodegenSingleHandler.java b/codegen-web/src/main/java/com/networknt/codegen/handler/CodegenSingleHandler.java
index a8d93836a..25a66c09d 100644
--- a/codegen-web/src/main/java/com/networknt/codegen/handler/CodegenSingleHandler.java
+++ b/codegen-web/src/main/java/com/networknt/codegen/handler/CodegenSingleHandler.java
@@ -13,6 +13,7 @@
import com.networknt.rpc.router.ServiceHandler;
import com.networknt.utility.HashUtil;
import com.networknt.utility.NioUtils;
+import com.networknt.utility.UuidUtil;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.HttpString;
import org.slf4j.Logger;
@@ -55,12 +56,12 @@ public class CodegenSingleHandler implements HybridHandler {
@Override
public ByteBuffer handle(HttpServerExchange exchange, Object input) {
// generate a destination folder name.
- String output = HashUtil.generateUUID();
+ String output = UuidUtil.uuidToBase64(UuidUtil.getUUID());
String zipFile = output + ".zip";
String projectFolder = codegenWebConfig.getTmpFolder() + separator + output;
Map generatorMap = (Map)input;
- if(logger.isDebugEnabled()) logger.debug("dataMap = " + JsonMapper.toJson(generatorMap));
+ if(logger.isDebugEnabled()) logger.debug("dataMap = {}", JsonMapper.toJson(generatorMap));
if(generatorMap == null) {
return NioUtils.toByteBuffer(getStatus(exchange, STATUS_MISSING_GENERATOR_ITEM));
diff --git a/codegen-web/src/main/resources/config/rpc-router.yml b/codegen-web/src/main/resources/config/rpc-router.yml
index b5d71936b..c8d27d572 100644
--- a/codegen-web/src/main/resources/config/rpc-router.yml
+++ b/codegen-web/src/main/resources/config/rpc-router.yml
@@ -1,4 +1,4 @@
---
description: RPC router description
-handlerPackage: 'com.networknt.codegen'
+handlerPackages: com.networknt.codegen
jsonPath: /codegen
diff --git a/codegen-web/src/main/resources/schema.json b/codegen-web/src/main/resources/schema.json
deleted file mode 100644
index 2eec45f57..000000000
--- a/codegen-web/src/main/resources/schema.json
+++ /dev/null
@@ -1,106 +0,0 @@
-{
- "lightapi.net/codegen/listFramework/0.0.1" : {
- "schema": {
- },
- "scope": "codegen.r"
- },
- "lightapi.net/codegen/getSchema/0.0.1" : {
- "schema": {
- "title" : "Service",
- "type" : "object",
- "properties" : {
- "framework": {
- "type" : "string"
- }
- },
- "required" : ["framework"]
- },
- "scope": "codegen.r"
- },
- "lightapi.net/codegen/validateUploadFile/0.0.1" : {
- "schema": {
- },
- "scope": "codegen.r"
- },
- "lightapi.net/codegen/multiple/0.0.1" : {
- "schema": {
- "title" : "Service",
- "type" : "object",
- "properties" : {
- "generators" : {
- "type" : "array",
- "items": {
- "properties": {
- "modelType": {
- "type": "string",
- "enum": ["C", "U"]
- },
- "modelText": {
- "type": ["string", "object"]
- },
- "modelUrl": {
- "type": "string"
- },
- "configType": {
- "type": "string",
- "enum": ["C", "U"]
- },
- "configText" : {
- "type": ["string", "object"]
- },
- "configUrl": {
- "type": "string"
- },
- "framework": {
- "type": "string"
- },
- "release": {
- "type": "string"
- }
- },
- "required": ["configType", "modelType", "framework", "release"]
- },
- "maxItems": 5,
- "minItems": 1
- }
- }
- },
- "scope": "codegen.w"
- },
- "lightapi.net/codegen/single/0.0.1" : {
- "schema": {
- "title" : "Service",
- "type" : "object",
- "properties": {
- "modelType": {
- "type": "string",
- "enum": ["C", "U"]
- },
- "modelText": {
- "type": ["string", "object"]
- },
- "modelUrl": {
- "type": "string"
- },
- "configType": {
- "type": "string",
- "enum": ["C", "U"]
- },
- "configText" : {
- "type": ["string", "object"]
- },
- "configUrl": {
- "type": "string"
- },
- "framework": {
- "type" : "string"
- },
- "release": {
- "type" : "string"
- }
- },
- "required": ["configType", "modelType", "framework", "release"]
- },
- "scope": "codegen.w"
- }
-}
diff --git a/codegen-web/src/main/resources/spec.yaml b/codegen-web/src/main/resources/spec.yaml
new file mode 100644
index 000000000..5d7b9aba1
--- /dev/null
+++ b/codegen-web/src/main/resources/spec.yaml
@@ -0,0 +1,122 @@
+---
+host: lightapi.net
+service: codegen
+schemas:
+ getSchemaRequest:
+ title: Service
+ type: object
+ properties:
+ framework:
+ type: string
+ required:
+ - framework
+ multipleRequest:
+ title: Service
+ type: object
+ properties:
+ generators:
+ type: array
+ items:
+ properties:
+ modelType:
+ type: string
+ enum:
+ - C
+ - U
+ modelText:
+ type:
+ - string
+ - object
+ modelUrl:
+ type: string
+ configType:
+ type: string
+ enum:
+ - C
+ - U
+ configText:
+ type:
+ - string
+ - object
+ configUrl:
+ type: string
+ framework:
+ type: string
+ release:
+ type: string
+ required:
+ - configType
+ - modelType
+ - framework
+ - release
+ maxItems: 5
+ minItems: 1
+ singleRequest:
+ title: Service
+ type: object
+ properties:
+ modelType:
+ type: string
+ enum:
+ - C
+ - U
+ modelText:
+ type:
+ - string
+ - object
+ modelUrl:
+ type: string
+ configType:
+ type: string
+ enum:
+ - C
+ - U
+ configText:
+ type:
+ - string
+ - object
+ configUrl:
+ type: string
+ framework:
+ type: string
+ release:
+ type: string
+ required:
+ - configType
+ - modelType
+ - framework
+ - release
+action:
+ - name: listFramework
+ version: 0.0.1
+ handler: ListFramework
+ scope: codegen.r
+ request:
+ schema: {}
+ - name: getSchema
+ version: 0.0.1
+ handler: GetSchema
+ scope: codegen.r
+ request:
+ schema:
+ $ref: '#/schemas/getSchemaRequest'
+ - name: validateUploadFile
+ version: 0.0.1
+ handler: ValidateUploadFile
+ scope: codegen.r
+ request:
+ schema: {}
+ - name: multiple
+ version: 0.0.1
+ handler: Multiple
+ scope: codegen.w
+ request:
+ schema:
+ $ref: '#/schemas/multipleRequest'
+ - name: single
+ version: 0.0.1
+ handler: Single
+ scope: codegen.w
+ request:
+ schema:
+ $ref: '#/schemas/singleRequest'
\ No newline at end of file
diff --git a/codegen-web/src/test/resources/config/values.yml b/codegen-web/src/test/resources/config/values.yml
index 71cd6357b..e831166b8 100644
--- a/codegen-web/src/test/resources/config/values.yml
+++ b/codegen-web/src/test/resources/config/values.yml
@@ -5,7 +5,6 @@ server.httpsPort: 49588
server.enableHttps: false
server.enableHttp2: false
-# unified-security.yml
# unified-security.yml
unified-security.pathPrefixAuths:
- prefix: /api/json
diff --git a/light-graphql-4j/pom.xml b/light-graphql-4j/pom.xml
index a068de9b2..3be0245bc 100644
--- a/light-graphql-4j/pom.xml
+++ b/light-graphql-4j/pom.xml
@@ -21,12 +21,13 @@
com.networknt
light-codegen
- 2.1.36
+ 2.3.2-SNAPSHOT
../pom.xml
light-graphql-4j-generator
jar
+ light-graphql-4j-generator
light-graphql-4j code generator.
diff --git a/light-graphql-4j/src/main/resources/binaries/client.keystore b/light-graphql-4j/src/main/resources/binaries/client.keystore
index c593b3758..7e8c001d4 100644
Binary files a/light-graphql-4j/src/main/resources/binaries/client.keystore and b/light-graphql-4j/src/main/resources/binaries/client.keystore differ
diff --git a/light-graphql-4j/src/main/resources/binaries/client.truststore b/light-graphql-4j/src/main/resources/binaries/client.truststore
index ded19d0cd..85c8aaff4 100644
Binary files a/light-graphql-4j/src/main/resources/binaries/client.truststore and b/light-graphql-4j/src/main/resources/binaries/client.truststore differ
diff --git a/light-graphql-4j/src/main/resources/binaries/server.keystore b/light-graphql-4j/src/main/resources/binaries/server.keystore
index feab9b6d2..d5269b527 100644
Binary files a/light-graphql-4j/src/main/resources/binaries/server.keystore and b/light-graphql-4j/src/main/resources/binaries/server.keystore differ
diff --git a/light-graphql-4j/src/main/resources/binaries/server.truststore b/light-graphql-4j/src/main/resources/binaries/server.truststore
index fb0c19ccb..f30e2d7fb 100644
Binary files a/light-graphql-4j/src/main/resources/binaries/server.truststore and b/light-graphql-4j/src/main/resources/binaries/server.truststore differ
diff --git a/light-graphql-4j/src/main/resources/templates/graphql/LICENSE.rocker.raw b/light-graphql-4j/src/main/resources/templates/graphql/LICENSE.rocker.raw
index 8dada3eda..d26ed5e27 100644
--- a/light-graphql-4j/src/main/resources/templates/graphql/LICENSE.rocker.raw
+++ b/light-graphql-4j/src/main/resources/templates/graphql/LICENSE.rocker.raw
@@ -178,7 +178,7 @@
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
+ boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright {yyyy} {name of copyright owner}
+ Copyright {yyyy} [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/light-graphql-4j/src/main/resources/templates/graphql/pom.xml.rocker.raw b/light-graphql-4j/src/main/resources/templates/graphql/pom.xml.rocker.raw
index 6d86b7b75..126c88213 100644
--- a/light-graphql-4j/src/main/resources/templates/graphql/pom.xml.rocker.raw
+++ b/light-graphql-4j/src/main/resources/templates/graphql/pom.xml.rocker.raw
@@ -9,20 +9,20 @@
@config.get("version").textValue()
- 11
+ 21
UTF-8
com.networknt.server.Server
- 2.1.36
- 2.17.1
- 2.0.13
+ 2.3.2-SNAPSHOT
+ 2.18.3
+ 2.0.17
0.9.6
- 1.5.6
- 5.8.1
- 2.3.15.Final
+ 1.5.26
+ 5.11.3
+ 2.3.22.Final
22.2
2.1.5
@if(config.get("supportDb").booleanValue() || config.get("supportH2ForTest").booleanValue()){
- 3.1.0
+ 6.2.1
}
@if(config.get("supportDb").booleanValue() && "oracle".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
11.2.0.3
@@ -31,10 +31,10 @@
8.0.32
}
@if(config.get("supportDb").booleanValue() && "postgres".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
- 42.7.2
+ 42.7.5
}
@if(config.get("supportH2ForTest").booleanValue()){
- 2.2.220
+ 2.3.232
}
2.4
1.0.0
diff --git a/light-hybrid-4j/pom.xml b/light-hybrid-4j/pom.xml
index 06ceee2a6..5bd719262 100644
--- a/light-hybrid-4j/pom.xml
+++ b/light-hybrid-4j/pom.xml
@@ -21,12 +21,13 @@
com.networknt
light-codegen
- 2.1.36
+ 2.3.2-SNAPSHOT
../pom.xml
light-hybrid-4j-generator
jar
+ light-hybrid-4j-generator
light-hybrid-4j code generator.
diff --git a/light-hybrid-4j/src/main/java/com/networknt/codegen/hybrid/HybridServerGenerator.java b/light-hybrid-4j/src/main/java/com/networknt/codegen/hybrid/HybridServerGenerator.java
index cf347c37c..1cb3428ed 100644
--- a/light-hybrid-4j/src/main/java/com/networknt/codegen/hybrid/HybridServerGenerator.java
+++ b/light-hybrid-4j/src/main/java/com/networknt/codegen/hybrid/HybridServerGenerator.java
@@ -84,12 +84,6 @@ public void generate(String targetPath, Object model, JsonNode config) throws IO
transfer(targetPath, "", ".project", templates.hybrid.project.template());
}
- // config
- transfer(targetPath, ("src.main.resources.config").replace(".", separator), "service.yml", templates.hybrid.serviceYml.template(config));
-
- transfer(targetPath, ("src.main.resources.config").replace(".", separator), "server.yml", templates.hybrid.serverYml.template(serviceId, enableHttp, httpPort, enableHttps, httpsPort, enableHttp2, enableRegistry, version));
- transfer(targetPath, ("src.test.resources.config").replace(".", separator), "server.yml", templates.hybrid.serverYml.template(serviceId, enableHttp, "49587", enableHttps, "49588", enableHttp2, enableRegistry, version));
-
if(kafkaProducer) {
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "kafka-producer.yml", templates.hybrid.kafkaProducerYml.template(kafkaTopic));
}
@@ -97,12 +91,6 @@ public void generate(String targetPath, Object model, JsonNode config) throws IO
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "kafka-streams.yml", templates.hybrid.kafkaStreamsYml.template(artifactId));
}
- // transfer(targetPath, ("src.main.resources.config").replace(".", separator), "secret.yml", templates.hybrid.secretYml.template());
- transfer(targetPath, ("src.main.resources.config").replace(".", separator), "security.yml", templates.hybrid.securityYml.template());
-
- transfer(targetPath, ("src.main.resources.config").replace(".", separator), "primary.crt", templates.hybrid.primaryCrt.template());
- transfer(targetPath, ("src.main.resources.config").replace(".", separator), "secondary.crt", templates.hybrid.secondaryCrt.template());
-
// logging
transfer(targetPath, ("src.main.resources").replace(".", separator), "logback.xml", templates.hybrid.logback.template());
transfer(targetPath, ("src.test.resources").replace(".", separator), "logback-test.xml", templates.hybrid.logback.template());
@@ -110,7 +98,8 @@ public void generate(String targetPath, Object model, JsonNode config) throws IO
// added with #471
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "app-status.yml", templates.hybrid.appStatusYml.template());
// values.yml file, transfer to suppress the warning message during start startup and encourage usage.
- transfer(targetPath, ("src.main.resources.config").replace(".", separator), "values.yml", templates.hybrid.values.template());
+ transfer(targetPath, ("src.main.resources.config").replace(".", separator), "values.yml", templates.hybrid.values.template(config, handlerPackage, jsonPath, serviceId, enableHttp, httpPort, enableHttps, httpsPort, enableHttp2, enableRegistry, version));
+ transfer(targetPath, ("src.test.resources.config").replace(".", separator), "values.yml", templates.hybrid.values.template(config, handlerPackage, jsonPath, serviceId, enableHttp, "49587", enableHttps, "49588", enableHttp2, enableRegistry, version));
// transfer binary files without touching them.
try (InputStream is = HybridServerGenerator.class.getResourceAsStream("/binaries/server.keystore")) {
@@ -138,9 +127,6 @@ public void generate(String targetPath, Object model, JsonNode config) throws IO
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "handler.yml",
templates.hybrid.handlerYml.template(serviceId, handlerPackage, jsonPath, prometheusMetrics));
- transfer(targetPath, ("src.main.resources.config").replace(".", separator), "rpc-router.yml",
- templates.hybrid.rpcRouterYml.template(handlerPackage, jsonPath));
-
}
diff --git a/light-hybrid-4j/src/main/java/com/networknt/codegen/hybrid/HybridServiceGenerator.java b/light-hybrid-4j/src/main/java/com/networknt/codegen/hybrid/HybridServiceGenerator.java
index f84cc3c69..1f74501f6 100644
--- a/light-hybrid-4j/src/main/java/com/networknt/codegen/hybrid/HybridServiceGenerator.java
+++ b/light-hybrid-4j/src/main/java/com/networknt/codegen/hybrid/HybridServiceGenerator.java
@@ -3,19 +3,16 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.networknt.codegen.Generator;
+import com.networknt.config.JsonMapper;
import org.apache.commons.text.StringEscapeUtils;
import java.io.ByteArrayInputStream;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import static java.io.File.separator;
@@ -81,12 +78,6 @@ public void generate(String targetPath, Object model, JsonNode config) throws IO
transfer(targetPath, "", ".project", templates.hybrid.project.template());
}
- // config
- transfer(targetPath, ("src.test.resources.config").replace(".", separator), "service.yml", templates.hybrid.serviceYml.template(config));
-
- transfer(targetPath, ("src.test.resources.config").replace(".", separator), "server.yml", templates.hybrid.serverYml.template(serviceId, enableHttp, "49587", enableHttps, "49588", enableHttp2, enableRegistry, version));
- //transfer(targetPath, ("src.test.resources.config").replace(".", separator), "secret.yml", templates.hybrid.secretYml.template());
- transfer(targetPath, ("src.test.resources.config").replace(".", separator), "security.yml", templates.hybrid.securityYml.template());
if(kafkaProducer) {
transfer(targetPath, ("src.test.resources.config").replace(".", separator), "kafka-producer.yml", templates.hybrid.kafkaProducerYml.template(kafkaTopic));
}
@@ -103,10 +94,9 @@ public void generate(String targetPath, Object model, JsonNode config) throws IO
// added with #471
transfer(targetPath, ("src.test.resources.config").replace(".", separator), "app-status.yml", templates.hybrid.appStatusYml.template());
// values.yml file, transfer to suppress the warning message during start startup and encourage usage.
- transfer(targetPath, ("src.test.resources.config").replace(".", separator), "values.yml", templates.hybrid.values.template());
+ transfer(targetPath, ("src.test.resources.config").replace(".", separator), "values.yml", templates.hybrid.values.template(config, handlerPackage, jsonPath, serviceId, enableHttp, "49587", enableHttps, "49588", enableHttp2, enableRegistry, version));
// handler
- Map services = new HashMap();
JsonNode anyModel = (JsonNode)model;
String host = anyModel.get("host").textValue();
String service = anyModel.get("service").textValue();
@@ -114,31 +104,36 @@ public void generate(String targetPath, Object model, JsonNode config) throws IO
if(jsonNode != null && jsonNode.isArray()) {
ArrayNode items = (ArrayNode)jsonNode;
for(JsonNode item : items) {
- JsonNode any = item.get("example");
+ JsonNode response = item.get("response");
+ JsonNode any = response == null ? null : response.get("example");
String example = any != null ? StringEscapeUtils.escapeJson(any.toString()).trim() : "";
if(!overwriteHandler && checkExist(targetPath, ("src.main.java." + handlerPackage).replace(".", separator), item.get("handler").textValue() + ".java")) {
continue;
}
transfer(targetPath, ("src.main.java." + handlerPackage).replace(".", separator), item.get("handler").textValue() + ".java", templates.hybrid.handler.template(handlerPackage, host, service, item, example));
- String sId = host + "/" + service + "/" + item.get("name").textValue() + "/" + item.get("version").textValue();
- Map map = new HashMap<>();
- map.put("schema", item.get("schema"));
- JsonNode anyScope = item.get("scope");
- String scope = anyScope != null ? anyScope.textValue().trim() : null;
- if(scope != null) map.put("scope", scope);
- JsonNode anySkipAuth = item.get("skipAuth");
- Boolean skipAuth = anySkipAuth != null ? anySkipAuth.booleanValue() : false;
- if(skipAuth != null) map.put("skipAuth", skipAuth);
- services.put(sId, map);
}
// handler test cases
transfer(targetPath, ("src.test.java." + handlerPackage + ".").replace(".", separator), "TestServer.java", templates.hybrid.testServer.template(handlerPackage));
for(JsonNode item : items) {
+ JsonNode request = item.get("request");
+ JsonNode any = request == null ? null : request.get("example");
+ String example = any != null ? any.toString() : null;
+ String body = "";
+ if(example != null) {
+ Map map = new LinkedHashMap<>();
+ map.put("host", host);
+ map.put("service", service);
+ map.put("action", item.get("name"));
+ map.put("version", item.get("version"));
+ map.put("data", JsonMapper.string2Map(example));
+ body = Generator.jsonMapper.writeValueAsString(map);
+ body = StringEscapeUtils.escapeJson(body);
+ }
if(!overwriteHandlerTest && checkExist(targetPath, ("src.test.java." + handlerPackage).replace(".", separator), item.get("handler").textValue() + "Test.java")) {
continue;
}
- transfer(targetPath, ("src.test.java." + handlerPackage).replace(".", separator), item.get("handler").textValue() + "Test.java", templates.hybrid.handlerTest.template(handlerPackage, host, service, item));
+ transfer(targetPath, ("src.test.java." + handlerPackage).replace(".", separator), item.get("handler").textValue() + "Test.java", templates.hybrid.handlerTest.template(handlerPackage, host, service, body, jsonPath, item));
}
}
@@ -164,12 +159,9 @@ public void generate(String targetPath, Object model, JsonNode config) throws IO
transfer(targetPath, ("src.test.resources.config").replace(".", separator), "handler.yml",
templates.hybrid.handlerYml.template(serviceId, handlerPackage, jsonPath, prometheusMetrics));
- transfer(targetPath, ("src.test.resources.config").replace(".", separator), "rpc-router.yml",
- templates.hybrid.rpcRouterYml.template(handlerPackage, jsonPath));
-
// write the generated schema into the config folder for schema validation.
- try (InputStream is = new ByteArrayInputStream(Generator.jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsBytes(services))) {
- Generator.copyFile(is, Paths.get(targetPath, ("src.main.resources").replace(".", separator), "schema.json"));
+ try (InputStream is = new ByteArrayInputStream(Generator.yamlMapper.writeValueAsBytes(model))) {
+ Generator.copyFile(is, Paths.get(targetPath, ("src.main.resources").replace(".", separator), "spec.yaml"));
}
}
}
diff --git a/light-hybrid-4j/src/main/resources/binaries/client.keystore b/light-hybrid-4j/src/main/resources/binaries/client.keystore
index c593b3758..7e8c001d4 100644
Binary files a/light-hybrid-4j/src/main/resources/binaries/client.keystore and b/light-hybrid-4j/src/main/resources/binaries/client.keystore differ
diff --git a/light-hybrid-4j/src/main/resources/binaries/client.truststore b/light-hybrid-4j/src/main/resources/binaries/client.truststore
index ded19d0cd..85c8aaff4 100644
Binary files a/light-hybrid-4j/src/main/resources/binaries/client.truststore and b/light-hybrid-4j/src/main/resources/binaries/client.truststore differ
diff --git a/light-hybrid-4j/src/main/resources/binaries/server.keystore b/light-hybrid-4j/src/main/resources/binaries/server.keystore
index feab9b6d2..d5269b527 100644
Binary files a/light-hybrid-4j/src/main/resources/binaries/server.keystore and b/light-hybrid-4j/src/main/resources/binaries/server.keystore differ
diff --git a/light-hybrid-4j/src/main/resources/binaries/server.truststore b/light-hybrid-4j/src/main/resources/binaries/server.truststore
index fb0c19ccb..f30e2d7fb 100644
Binary files a/light-hybrid-4j/src/main/resources/binaries/server.truststore and b/light-hybrid-4j/src/main/resources/binaries/server.truststore differ
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/LICENSE.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/LICENSE.rocker.raw
index 8dada3eda..261eeb9e9 100644
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/LICENSE.rocker.raw
+++ b/light-hybrid-4j/src/main/resources/templates/hybrid/LICENSE.rocker.raw
@@ -178,7 +178,7 @@
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
+ boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright {yyyy} {name of copyright owner}
+ Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/gitignore.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/gitignore.rocker.raw
index 7883fdc01..98967ea7e 100644
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/gitignore.rocker.raw
+++ b/light-hybrid-4j/src/main/resources/templates/hybrid/gitignore.rocker.raw
@@ -11,9 +11,24 @@ dist/
*.iml
*.log
*.tmp
-*.zip
*.bak
dependency-reduced-pom.xml
+# Compiled class file
+*.class
+
+# BlueJ files
+*.ctxt
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.tar.gz
+*.rar
+*.zip
+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
+replay_pid*
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/handler.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/handler.rocker.raw
index 411143d91..39638dc84 100644
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/handler.rocker.raw
+++ b/light-hybrid-4j/src/main/resources/templates/hybrid/handler.rocker.raw
@@ -3,7 +3,7 @@
package @handlerPackage;
import com.networknt.utility.NioUtils;
-import com.networknt.rpc.Handler;
+import com.networknt.rpc.HybridHandler;
import com.networknt.rpc.router.ServiceHandler;
import java.nio.ByteBuffer;
import io.undertow.server.HttpServerExchange;
@@ -13,7 +13,7 @@ For more information on how to write business handlers, please check the link be
https://doc.networknt.com/development/business-handler/hybrid/
*/
@@ServiceHandler(id="@host/@service/@item.get("name").textValue()/@item.get("version").textValue()")
-public class @item.get("handler").textValue() implements Handler {
+public class @item.get("handler").textValue() implements HybridHandler {
@@Override
public ByteBuffer handle(HttpServerExchange exchange, Object input) {
return NioUtils.toByteBuffer("@example");
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/handlerTest.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/handlerTest.rocker.raw
index 426cceda3..904992956 100644
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/handlerTest.rocker.raw
+++ b/light-hybrid-4j/src/main/resources/templates/hybrid/handlerTest.rocker.raw
@@ -1,5 +1,5 @@
@import com.fasterxml.jackson.databind.JsonNode
-@args (String handlerPackage, String host, String service, JsonNode item)
+@args (String handlerPackage, String host, String service, String body, String jsonPath, JsonNode item)
package @handlerPackage;
import com.networknt.client.Http2Client;
@@ -39,7 +39,6 @@ import java.util.concurrent.atomic.AtomicReference;
@@Test
@with(s3 = item.get("handler").textValue() + "()") {public void test@s3} throws ClientException, ApiException {
- /*
final CountDownLatch latch = new CountDownLatch(1);
SimpleConnectionHolder.ConnectionToken connectionToken = null;
@@ -51,12 +50,12 @@ import java.util.concurrent.atomic.AtomicReference;
connectionToken = client.borrow(new URI(url), Http2Client.WORKER, Http2Client.BUFFER_POOL, OptionMap.EMPTY);
}
ClientConnection connection = (ClientConnection) connectionToken.getRawConnection();
-
- ClientRequest request = new ClientRequest().setPath("/api/json").setMethod(Methods.POST);
+ String body = "@body";
+ ClientRequest request = new ClientRequest().setPath("@jsonPath").setMethod(Methods.POST);
request.getRequestHeaders().put(Headers.CONTENT_TYPE, "application/json");
request.getRequestHeaders().put(Headers.TRANSFER_ENCODING, "chunked");
request.getRequestHeaders().put(new HttpString("host"), "localhost");
- connection.sendRequest(request, client.createClientCallback(reference, latch, "request body to be replaced"));
+ connection.sendRequest(request, client.createClientCallback(reference, latch, body));
latch.await();
} catch (Exception e) {
logger.error("Exception: ", e);
@@ -68,6 +67,5 @@ import java.util.concurrent.atomic.AtomicReference;
String body = reference.get().getAttachment(Http2Client.RESPONSE_BODY);
Assertions.assertEquals(200, statusCode);
Assertions.assertNotNull(body);
- */
}
}
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/handlerYml.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/handlerYml.rocker.raw
index d491d0302..ac69dda94 100644
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/handlerYml.rocker.raw
+++ b/light-hybrid-4j/src/main/resources/templates/hybrid/handlerYml.rocker.raw
@@ -45,21 +45,22 @@ handlers:
# Light-framework cross-cutting concerns implemented in the microservice
- com.networknt.exception.ExceptionHandler@@exception
@if(prometheusMetrics){ - com.networknt.metrics.prometheus.PrometheusHandler@@prometheus} else { - com.networknt.metrics.MetricsHandler@@metrics}
- # - com.networknt.traceability.TraceabilityHandler@@traceability
- # - com.networknt.correlation.CorrelationHandler@@correlation
- - com.networknt.jaeger.tracing.JaegerHandler@@jaeger
+ - com.networknt.correlation.CorrelationHandler@@correlation
- com.networknt.cors.CorsHttpHandler@@cors
+ - com.networknt.body.BodyHandler@@body
# - com.networknt.audit.AuditHandler@@audit
# DumpHandler is to dump detail request/response info to log, useful for troubleshooting but not suggested to use in production due to it may lower the performance
# - com.networknt.dump.DumpHandler@@dump
# - com.networknt.sanitizer.SanitizerHandler@@sanitizer
- com.networknt.rpc.router.JsonHandler@@json
+ - com.networknt.rpc.router.SchemaHandler@@schema
+ - com.networknt.rpc.security.HybridJwtVerifyHandler@@security
+
# Customer business domain specific cross-cutting concerns handlers
# - com.example.validator.CustomizedValidator@@custvalidator
# Framework endpoint handlers
- com.networknt.health.HealthGetHandler@@health
- com.networknt.info.ServerInfoGetHandler@@info
- - com.networknt.openapi.JwtVerifyHandler@@security
- com.networknt.logging.handler.LoggerGetHandler@@getLogger
- com.networknt.logging.handler.LoggerPostHandler@@postLogger
- com.networknt.logging.handler.LoggerGetLogContentsHandler@@getLogContents
@@ -74,10 +75,10 @@ chains:
default:
- exception
@if(prometheusMetrics){ - prometheus} else { - metrics}
- - traceability
- correlation
- # - dump
- cors
+ - schema
+ - security
- json
paths:
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/logback.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/logback.rocker.raw
index 73e1812ee..390e4c1e3 100644
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/logback.rocker.raw
+++ b/light-hybrid-4j/src/main/resources/templates/hybrid/logback.rocker.raw
@@ -16,8 +16,6 @@
-->
- TODO create logger for audit only.
- http://stackoverflow.com/questions/2488558/logback-to-log-different-messages-to-two-files
PROFILER
@@ -63,8 +61,12 @@
-
-
+
+
+
+
+
+
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/primaryCrt.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/primaryCrt.rocker.raw
deleted file mode 100644
index 34f9272f8..000000000
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/primaryCrt.rocker.raw
+++ /dev/null
@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDmzCCAoOgAwIBAgIEHnAgtDANBgkqhkiG9w0BAQsFADB+MQswCQYDVQQGEwJDQTEQMA4GA1UE
-CBMHT250YXJpbzEUMBIGA1UEBxMLTWlzc2lzc2F1Z2ExJjAkBgNVBAoTHU5ldHdvcmsgTmV3IFRl
-Y2hub2xvZ2llcyBJbmMuMQwwCgYDVQQLEwNERVYxETAPBgNVBAMTCFN0ZXZlIEh1MB4XDTE2MDkw
-MTE2MTYxNVoXDTI2MDcxMTE2MTYxNVowfjELMAkGA1UEBhMCQ0ExEDAOBgNVBAgTB09udGFyaW8x
-FDASBgNVBAcTC01pc3Npc3NhdWdhMSYwJAYDVQQKEx1OZXR3b3JrIE5ldyBUZWNobm9sb2dpZXMg
-SW5jLjEMMAoGA1UECxMDREVWMREwDwYDVQQDEwhTdGV2ZSBIdTCCASIwDQYJKoZIhvcNAQEBBQAD
-ggEPADCCAQoCggEBALrlxMtDb60DogElf4TBz504tRheZimAE0dJL/Yby4nacJdqvc5l4z+WWpDf
-rI9krQ2Yi9yvhwAP+PrR6gWcIqWP4cpNE7XIAUDgr4CtyI7CptT/lpjtbkz4DGCMmaeDn0jqHqJt
-SeSZGfwVu5zAGm8n4sHatjnnxBI/iWzkTII3V4xv0WeK37szNTEd+ly2ag7n2IV5zNnYmqZTeMQm
-J2ENS+IwAG3ENtiVtrVTx/2bGtqutJjtdxsN58/cUG/guRyMT6OPI8Yi3ZzevdvRbxadyhEl/Kaw
-6vJcdxmJI3tp4lx+p6sAxOWa7aapJe4JxutAQqzv0GKdVjoHKQ1wB60CAwEAAaMhMB8wHQYDVR0O
-BBYEFIPF9SBd06RWU1eDL73CKfy01lavMA0GCSqGSIb3DQEBCwUAA4IBAQAoaKZGOak3Upz/ordF
-slZoJuZlCu7jnKQEjYwHf3DNxcd1WmgFPtMcna6pW0VUxPIfidEA6VCMsGoK1RvshB0SjrRdCht6
-5qPXs9kV3NW0WvMiwDSYZZ9HgaZ9efTe5E9Fzc7ltKrE43L6k8NJcaEEWEdpdjFbrAqH4I+j/Vro
-K3OhIo062fXjas5ipL4gF+3ECImjWzirQP8UiAfM0/36x7rtAu3btH/qI9hSyx39LBPPE5AsDJZ4
-dSMwNTW1gqmBAZIj+zQ/RD5dyWfPwON7Q+t96YbK6WBuYo0xy+I+PjcUgrWYWP3N24hlq8ZBIei+
-BudoEVJlIlmS0aRCuP8n
------END CERTIFICATE-----
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/rpcRouterYml.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/rpcRouterYml.rocker.raw
deleted file mode 100644
index 31fd303fc..000000000
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/rpcRouterYml.rocker.raw
+++ /dev/null
@@ -1,3 +0,0 @@
-@args (String handlerPackage, String jsonPath)
-handlerPackage: '@handlerPackage'
-jsonPath: @jsonPath
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/secondaryCrt.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/secondaryCrt.rocker.raw
deleted file mode 100644
index dfbd3ceac..000000000
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/secondaryCrt.rocker.raw
+++ /dev/null
@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDkzCCAnugAwIBAgIEUBGbJDANBgkqhkiG9w0BAQsFADB6MQswCQYDVQQGEwJDQTEQMA4GA1UE
-CBMHT250YXJpbzEQMA4GA1UEBxMHVG9yb250bzEmMCQGA1UEChMdTmV0d29yayBOZXcgVGVjaG5v
-bG9naWVzIEluYy4xDDAKBgNVBAsTA0FQSTERMA8GA1UEAxMIU3RldmUgSHUwHhcNMTYwOTIyMjI1
-OTIxWhcNMjYwODAxMjI1OTIxWjB6MQswCQYDVQQGEwJDQTEQMA4GA1UECBMHT250YXJpbzEQMA4G
-A1UEBxMHVG9yb250bzEmMCQGA1UEChMdTmV0d29yayBOZXcgVGVjaG5vbG9naWVzIEluYy4xDDAK
-BgNVBAsTA0FQSTERMA8GA1UEAxMIU3RldmUgSHUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
-AoIBAQCqYfarFwug2DwpG/mmcW77OluaHVNsKEVJ/BptLp5suJAH/Z70SS5pwM4x2QwMOVO2ke8U
-rsAws8allxcuKXrbpVt4evpO1Ly2sFwqB1bjN3+VMp6wcT+tSjzYdVGFpQAYHpeA+OLuoHtQyfpB
-0KCveTEe3KAG33zXDNfGKTGmupZ3ZfmBLINoey/X13rY71ITt67AY78VHUKb+D53MBahCcjJ9YpJ
-UHG+Sd3d4oeXiQcqJCBCVpD97awWARf8WYRIgU1xfCe06wQ3CzH3+GyfozLeu76Ni5PwE1tm7Dhg
-EDSSZo5khmzVzo4G0T2sOeshePc5weZBNRHdHlJA0L0fAgMBAAGjITAfMB0GA1UdDgQWBBT9rnek
-spnrFus5wTszjdzYgKll9TANBgkqhkiG9w0BAQsFAAOCAQEAT8udTfUGBgeWbN6ZAXRI64VsSJj5
-1sNUN1GPDADLxZF6jArKU7LjBNXn9bG5VjJqlx8hQ1SNvi/t7FqBRCUt/3MxDmGZrVZqLY1kZ2e7
-x+5RykbspA8neEUtU8sOr/NP3O5jBjU77EVec9hNNT5zwKLevZNL/Q5mfHoc4GrIAolQvi/5fEqC
-8OMdOIWS6sERgjaeI4tXxQtHDcMo5PeLW0/7t5sgEsadZ+pkdeEMVTmLfgf97bpNNI7KF5uEbYnQ
-NpwCT+NNC5ACmJmKidrfW23kml1C7vr7YzTevw9QuH/hN8l/Rh0fr+iPEVpgN6Zv00ymoKGmjuuW
-owVmdKg/0w==
------END CERTIFICATE-----
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/securityYml.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/securityYml.rocker.raw
deleted file mode 100644
index 30eb86b60..000000000
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/securityYml.rocker.raw
+++ /dev/null
@@ -1,38 +0,0 @@
-# Security configuration for hybrid-security in light-hybrid-4j. It is a specific config
-# for Hybrid framework security. It is introduced to support multiple frameworks in the
-# same server instance. If this file cannot be found, the generic security.yml will be
-# loaded for backward compatibility.
----
-# Enable JWT verification flag.
-enableVerifyJwt: false
-
-# Enable JWT scope verification. Only valid when enableVerifyJwt is true.
-enableVerifyScope: true
-
-# User for test only. should be always be false on official environment.
-enableMockJwt: false
-
-# JWT signature public certificates. kid and certificate path mappings.
-jwt:
- certificate:
- '100': primary.crt
- '101': secondary.crt
- clockSkewInSeconds: 60
- # Key distribution server standard: JsonWebKeySet for other OAuth 2.0 provider| X509Certificate for light-oauth2
- keyResolver: X509Certificate
-
-# Enable or disable JWT token logging
-logJwtToken: true
-
-# Enable or disable client_id, user_id and scope logging.
-logClientUserScope: false
-
-# Enable JWT token cache to speed up verification. This will only verify expired time
-# and skip the signature verification as it takes more CPU power and long time.
-enableJwtCache: true
-
-# If you are using light-oauth2, then you don't need to have oauth subfolder for public
-# key certificate to verify JWT token, the key will be retrieved from key endpoint once
-# the first token is arrived. Default to false for dev environment without oauth2 server
-# or official environment that use other OAuth 2.0 providers.
-bootstrapFromKeyService: false
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/server/pom.xml.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/server/pom.xml.rocker.raw
index c6fa050f8..b47149c06 100644
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/server/pom.xml.rocker.raw
+++ b/light-hybrid-4j/src/main/resources/templates/hybrid/server/pom.xml.rocker.raw
@@ -9,37 +9,37 @@
@config.get("version").textValue()
- 11
+ 21
UTF-8
com.networknt.server.Server
- 2.1.36
- 2.17.1
- 2.0.13
+ 2.3.2-SNAPSHOT
+ 2.18.3
+ 2.0.17
0.9.6
- 1.5.6
- 5.8.1
- 2.3.15.Final
+ 1.5.26
+ 5.11.3
+ 2.3.22.Final
1.5.1
- @if(config.get("supportDb").booleanValue() || config.get("supportH2ForTest").booleanValue()){
- 3.1.0
+ @if((config.get("supportDb") != null && config.get("supportDb").booleanValue()) || (config.get("supportH2ForTest") != null && config.get("supportH2ForTest").booleanValue())){
+ 6.2.1
}
- @if(config.get("supportDb").booleanValue() && "oracle".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
+ @if(config.get("supportDb") != null && config.get("supportDb").booleanValue() && "oracle".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
11.2.0.3
}
- @if(config.get("supportDb").booleanValue() && "mysql".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
+ @if(config.get("supportDb") != null && config.get("supportDb").booleanValue() && "mysql".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
8.0.32
}
- @if(config.get("supportDb").booleanValue() && "postgres".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
- 42.7.2
+ @if(config.get("supportDb") != null && config.get("supportDb").booleanValue() && "postgres".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
+ 42.7.5
}
@if(config.get("supportH2ForTest").booleanValue()){
- 2.2.220
+ 2.3.232
}
@if(config.get("supportAvro").booleanValue()){
- 7.6.0
+ 7.9.1
}
@if(config.get("kafkaProducer").booleanValue() || config.get("kafkaConsumer").booleanValue()){
- 3.6.0
+ 3.9.1
}
2.4
1.0.0
@@ -76,17 +76,17 @@
com.networknt
- traceability
+ correlation
${version.light-4j}
com.networknt
- correlation
+ rpc-router
${version.light-4j}
com.networknt
- rpc-router
+ rpc-security
${version.light-4j}
@@ -101,12 +101,37 @@
com.networknt
- cors
+ logger-handler
+ ${version.light-4j}
+
+
+ com.networknt
+ config-reload
+ ${version.light-4j}
+
+
+ com.networknt
+ cache-manager
+ ${version.light-4j}
+
+
+ com.networknt
+ caffeine-cache
${version.light-4j}
com.networknt
- jaeger-tracing
+ cache-explorer
+ ${version.light-4j}
+
+
+ com.networknt
+ body
+ ${version.light-4j}
+
+
+ com.networknt
+ cors
${version.light-4j}
@@ -170,28 +195,28 @@
undertow-core
${version.undertow}
- @if(config.get("supportDb").booleanValue() || config.get("supportH2ForTest").booleanValue()){
+ @if((config.get("supportDb") != null && config.get("supportDb").booleanValue()) || (config.get("supportH2ForTest") != null && config.get("supportH2ForTest").booleanValue())){
com.zaxxer
HikariCP
${version.hikaricp}
}
- @if(config.get("supportDb").booleanValue() && "oracle".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
+ @if(config.get("supportDb") != null && config.get("supportDb").booleanValue() && "oracle".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
com.oracle
ojdbc6
${version.oracle}
}
- @if(config.get("supportDb").booleanValue() && "mysql".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
+ @if(config.get("supportDb") != null && config.get("supportDb").booleanValue() && "mysql".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
mysql
mysql-connector-java
${version.mysql}
}
- @if(config.get("supportDb").booleanValue() && "postgres".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
+ @if(config.get("supportDb") != null && config.get("supportDb").booleanValue() && "postgres".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
org.postgresql
postgresql
@@ -329,16 +354,27 @@
@if(config.get("supportAvro").booleanValue()){
confluent
- http://packages.confluent.io/maven/
+ https://packages.confluent.io/maven/
- }
- sonatype-snapshots
+ jitpack.io
+ https://jitpack.io
+
+ }
+
+ ossrh
https://oss.sonatype.org/content/repositories/snapshots
true
+
+ s01
+ https://s01.oss.sonatype.org/content/repositories/snapshots
+
+ true
+
+
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/serverYml.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/serverYml.rocker.raw
deleted file mode 100644
index f4fd14c55..000000000
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/serverYml.rocker.raw
+++ /dev/null
@@ -1,123 +0,0 @@
-@args (String serviceId, Boolean enableHttp, String httpPort, Boolean enableHttps, String httpsPort, Boolean enableHttp2, Boolean enableRegistry, String version)
-# Server configuration
----
-# This is the default binding address if the service is dockerized.
-ip: ${server.ip:0.0.0.0}
-
-# Http port if enableHttp is true. It will be ignored if dynamicPort is true.
-httpPort: ${server.httpPort:@httpPort}
-
-# Enable HTTP should be false by default. It should be only used for testing with clients or tools
-# that don't support https or very hard to import the certificate. Otherwise, https should be used.
-# When enableHttp, you must set enableHttps to false, otherwise, this flag will be ignored. There is
-# only one protocol will be used for the server at anytime. If both http and https are true, only
-# https listener will be created and the server will bind to https port only.
-enableHttp: ${server.enableHttp:@enableHttp}
-
-# Https port if enableHttps is true. It will be ignored if dynamicPort is true.
-httpsPort: ${server.httpsPort:@httpsPort}
-
-# Enable HTTPS should be true on official environment and most dev environments.
-enableHttps: ${server.enableHttps:@enableHttps}
-
-# Http/2 is enabled by default for better performance and it works with the client module
-# Please note that HTTP/2 only works with HTTPS.
-enableHttp2: ${server.enableHttp2:@enableHttp2}
-
-# Keystore file name in config folder.
-keystoreName: ${server.keystoreName:server.keystore}
-
-# Keystore password
-keystorePass: ${server.keystorePass:password}
-
-# Private key password
-keyPass: ${server.keyPass:password}
-
-# Flag that indicate if two way TLS is enabled. Not recommended in docker container.
-enableTwoWayTls: ${server.enableTwoWayTls:false}
-
-# Truststore file name in config folder.
-truststoreName: ${server.truststoreName:server.truststore}
-
-# Truststore password
-truststorePass: ${server.truststorePass:password}
-
-# Bootstrap truststore name used to connect to the light-config-server if it is used.
-bootstrapStoreName: ${server.bootstrapStoreName:bootstrap.truststore}
-
-# Bootstrap truststore password
-bootstrapStorePass: ${server.bootstrapStorePass:password}
-
-# Unique service identifier. Used in service registration and discovery etc.
-serviceId: ${server.serviceId:@serviceId}
-
-# Flag to enable self service registration. This should be turned on on official test and production. And
-# dyanmicPort should be enabled if any orchestration tool is used like Kubernetes.
-enableRegistry: ${server.enableRegistry:@enableRegistry}
-
-# When enableRegistry is true and the registry/discovery service is not reachable. Stop the server or continue
-# starting the server. When your global registry is not setup as high availability and only for monitoring, you
-# can set it true. If you are using it for global service discovery, leave it with false.
-startOnRegistryFailure: ${server.startOnRegistryFailure:false}
-
-# Dynamic port is used in situation that multiple services will be deployed on the same host and normally
-# you will have enableRegistry set to true so that other services can find the dynamic port service. When
-# deployed to Kubernetes cluster, the Pod must be annotated as hostNetwork: true
-dynamicPort: ${server.dynamicPort:false}
-
-# Minimum port range. This define a range for the dynamic allocated ports so that it is easier to setup
-# firewall rule to enable this range. Default 2400 to 2500 block has 100 port numbers and should be
-# enough for most cases unless you are using a big bare metal box as Kubernetes node that can run 1000s pods
-minPort: ${server.minPort:2400}
-
-# Maximum port rang. The range can be customized to adopt your network security policy and can be increased or
-# reduced to ease firewall rules.
-maxPort: ${server.maxPort:2500}
-
-# environment tag that will be registered on consul to support multiple instances per env for testing.
-# https://github.com/networknt/light-doc/blob/master/docs/content/design/env-segregation.md
-# This tag should only be set for testing env, not production. The production certification process will enforce it.
-# environment: ${server.environment:test1}
-
-# Build Number, to be set by teams for auditing or tracing purposes.
-# Allows teams to audit the value and set it according to their release management process
-buildNumber: ${server.buildNumber:@version}
-
-# Shutdown gracefully wait period in milliseconds
-# In this period, it allows the in-flight requests to complete but new requests are not allowed. It needs to be set
-# based on the slowest request possible.
-shutdownGracefulPeriod: ${server.shutdownGracefulPeriod:2000}
-
-# -----------------------------------------------------------------------------------------------------------
-# The following parameters are for advanced users to fine tune the service in a container environment. Please leave
-# these values default if you do not understand. For more info, visit https://doc.networknt.com/concern/server/
-
-# Unique service name. Used in microservice to associate a given name to a service with configuration
-# or as a key within the configuration of a particular domain
-# serviceName: ${server.serviceName:petstore}
-
-# Buffer size of undertow server. Default to 16K
-# bufferSize: ${server.bufferSize:16384}
-
-# Number of IO thread. Default to number of processor * 2
-# ioThreads: ${server.ioThreads:4}
-
-# Number of worker threads. Default to 200 and it can be reduced to save memory usage in a container with only one cpu
-# workerThreads: ${server.workerThreads:200}
-
-# Backlog size. Default to 10000
-# backlog: ${server.backlog:10000}
-
-# Flag to set UndertowOptions.ALWAYS_SET_DATE
-# alwaysSetDate: ${server.alwaysSetDate:false}
-
-# Server string used to mark the server. Default to L for light-4j.
-# serverString: ${server.serverString:L}
-
-# Flag to set UndertowOptions.ALLOW_UNESCAPED_CHARACTERS_IN_URL. Default to false.
-# Please note that this option widens the attack surface and attacker can potentially access your filesystem.
-# This should only be used on an internal server and never be used on a server accessed from the Internet.
-# allowUnescapedCharactersInUrl: ${server.allowUnescapedCharactersInUrl:false}
-
-# Set the max transfer file size for uploading files. Default to 1000000 which is 1 MB.
-# maxTransferFileSize: ${server.maxTransferFileSize:1000000}
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/service/pom.xml.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/service/pom.xml.rocker.raw
index 01f167196..d9521bb53 100644
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/service/pom.xml.rocker.raw
+++ b/light-hybrid-4j/src/main/resources/templates/hybrid/service/pom.xml.rocker.raw
@@ -9,37 +9,37 @@
@config.get("version").textValue()
- 11
+ 21
UTF-8
com.networknt.server.Server
- 2.1.36
- 2.17.1
- 2.0.13
+ 2.3.2-SNAPSHOT
+ 2.18.3
+ 2.0.17
0.9.6
- 1.5.6
- 5.8.1
- 2.3.15.Final
+ 1.5.26
+ 5.11.3
+ 2.3.22.Final
1.5.1
- @if(config.get("supportDb").booleanValue() || config.get("supportH2ForTest").booleanValue()){
- 3.1.0
+ @if((config.get("supportDb") != null && config.get("supportDb").booleanValue()) || config.get("supportH2ForTest").booleanValue()){
+ 6.2.1
}
- @if(config.get("supportDb").booleanValue() && "oracle".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
+ @if(config.get("supportDb") != null && config.get("supportDb").booleanValue() && "oracle".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
11.2.0.3
}
- @if(config.get("supportDb").booleanValue() && "mysql".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
+ @if(config.get("supportDb") != null && config.get("supportDb").booleanValue() && "mysql".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
8.0.32
}
- @if(config.get("supportDb").booleanValue() && "postgres".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
- 42.7.2
+ @if(config.get("supportDb") != null && config.get("supportDb").booleanValue() && "postgres".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
+ 42.7.5
}
@if(config.get("supportH2ForTest").booleanValue()){
- 2.2.220
+ 2.3.232
}
@if(config.get("supportAvro").booleanValue()){
- 7.6.0
+ 7.9.1
}
@if(config.get("kafkaProducer").booleanValue() || config.get("kafkaConsumer").booleanValue()){
- 3.6.0
+ 3.9.1
}
2.4
1.0.0
@@ -66,17 +66,17 @@
com.networknt
- traceability
+ correlation
${version.light-4j}
com.networknt
- correlation
+ rpc-router
${version.light-4j}
com.networknt
- rpc-router
+ rpc-security
${version.light-4j}
@@ -91,12 +91,37 @@
com.networknt
- cors
+ logger-handler
+ ${version.light-4j}
+
+
+ com.networknt
+ config-reload
+ ${version.light-4j}
+
+
+ com.networknt
+ cache-manager
+ ${version.light-4j}
+
+
+ com.networknt
+ caffeine-cache
+ ${version.light-4j}
+
+
+ com.networknt
+ cache-explorer
${version.light-4j}
com.networknt
- jaeger-tracing
+ body
+ ${version.light-4j}
+
+
+ com.networknt
+ cors
${version.light-4j}
@@ -155,28 +180,28 @@
undertow-core
${version.undertow}
- @if(config.get("supportDb").booleanValue() || config.get("supportH2ForTest").booleanValue()){
+ @if((config.get("supportDb") != null && config.get("supportDb").booleanValue()) || (config.get("supportH2ForTest") != null && config.get("supportH2ForTest").booleanValue())){
com.zaxxer
HikariCP
${version.hikaricp}
}
- @if(config.get("supportDb").booleanValue() && "oracle".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
+ @if(config.get("supportDb") != null && config.get("supportDb").booleanValue() && "oracle".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
com.oracle
ojdbc6
${version.oracle}
}
- @if(config.get("supportDb").booleanValue() && "mysql".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
+ @if(config.get("supportDb") != null && config.get("supportDb").booleanValue() && "mysql".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
mysql
mysql-connector-java
${version.mysql}
}
- @if(config.get("supportDb").booleanValue() && "postgres".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
+ @if(config.get("supportDb") != null && config.get("supportDb").booleanValue() && "postgres".equalsIgnoreCase(config.path("dbInfo").path("name").textValue())){
org.postgresql
postgresql
@@ -314,94 +339,30 @@
@if(config.get("supportAvro").booleanValue()){
confluent
- http://packages.confluent.io/maven/
+ https://packages.confluent.io/maven/
- }
- sonatype-snapshots
+ jitpack.io
+ https://jitpack.io
+
+ }
+
+ ossrh
https://oss.sonatype.org/content/repositories/snapshots
true
+
+ s01
+ https://s01.oss.sonatype.org/content/repositories/snapshots
+
+ true
+
+
-
- release
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
- ${version.maven-shade}
-
-
- package
-
- shade
-
-
- ${project.build.directory}/dependency-reduced-pom.xml
-
-
- *:*
-
- module-info.class
- META-INF/*.SF
- META-INF/*.DSA
- META-INF/*.RSA
-
-
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- ${version.maven-source}
-
-
- attach-sources
-
- jar
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- ${version.maven-javadoc}
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
- ${version.exec-maven}
-
- java
-
- -jar
- ${project.build.directory}/${project.build.finalName}.${project.packaging}
-
-
-
-
-
-
debug
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/serviceYml.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/serviceYml.rocker.raw
deleted file mode 100644
index 25f37d760..000000000
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/serviceYml.rocker.raw
+++ /dev/null
@@ -1,41 +0,0 @@
-@import com.fasterxml.jackson.databind.JsonNode
-@args (JsonNode config)
-# Singleton service factory configuration/IoC injection
-singletons:
-# StartupHookProvider implementations, there are one to many and they are called in the same sequence defined.
-- com.networknt.server.StartupHookProvider:
- # registry all service handlers by from annotations
- - com.networknt.rpc.router.RpcStartupHookProvider
- @if(config.get("kafkaProducer").booleanValue()){
- # Kafka producer startup hook example
- # - net.lightapi.portal.user.command.UserCommandStartup
- }
- @if(config.get("kafkaConsumer").booleanValue()){
- # Kafka consumer startup hook example
- # - net.lightapi.portal.user.query.UserQueryStartup
- }
-# ShutdownHookProvider implementations, there are one to many and they are called in the same sequence defined.
-- com.networknt.server.ShutdownHookProvider:
- @if(config.get("kafkaProducer").booleanValue()){
- # Kafka producer startup hook example
- # - net.lightapi.portal.user.command.UserCommandShutdown
- }
- @if(config.get("kafkaConsumer").booleanValue()){
- # Kafka consumer startup hook example
- # - net.lightapi.portal.user.query.UserQueryShutdown
- }
-@if(config.get("kafkaProducer").booleanValue()){
-# Kafka Producer instance
-- com.networknt.kafka.producer.NativeLightProducer:
- - com.networknt.kafka.producer.SidecarProducer
-}
-@if(config.get("kafkaStreams").booleanValue()){
-- com.networknt.kafka.streams.LightStreams:
- # Kafka streams processor example
- # - net.lightapi.portal.user.query.UserQueryStreams
-}
-@if(config.get("kafkaStreams").booleanValue()||config.get("kafkaProducer").booleanValue()||config.get("kafkaConsumer").booleanValue()){
-# Schema registry client
-- io.confluent.kafka.schemaregistry.client.SchemaRegistryClient:
- - com.networknt.kafka.common.LightSchemaRegistryClient
-}
diff --git a/light-hybrid-4j/src/main/resources/templates/hybrid/values.rocker.raw b/light-hybrid-4j/src/main/resources/templates/hybrid/values.rocker.raw
index 8f98d76bd..e7d856788 100644
--- a/light-hybrid-4j/src/main/resources/templates/hybrid/values.rocker.raw
+++ b/light-hybrid-4j/src/main/resources/templates/hybrid/values.rocker.raw
@@ -1,3 +1,5 @@
+@import com.fasterxml.jackson.databind.JsonNode
+@args (JsonNode config, String handlerPackage, String jsonPath, String serviceId, Boolean enableHttp, String httpPort, Boolean enableHttps, String httpsPort, Boolean enableHttp2, Boolean enableRegistry, String version)
#--------------------------------------------------------------------------------
# values.yml : Set of values commonly overridden in microservices
#--------------------------------------------------------------------------------
@@ -5,10 +7,60 @@
# client.yml
# server.yml
-server.serviceId: com.networknt.placeholder-1.0.0
+server.serviceId: @serviceId
+server.httpPort: @httpPort
+server.enableHttp: @enableHttp
+server.httpsPort: @httpsPort
+server.enableHttps: @enableHttps
+server.enableHttp2: @enableHttp2
+server.enableRegistry: @enableRegistry
+server.buildNumber: @version
+
# security.yml
-security.enableVerifyJwt: true
+security.enableVerifyJwt: false
+
+# rpc-router.yml
+rpc-router.handlerPackage: @handlerPackage
+rpc-router.jsonPath: @jsonPath
# service.yml
+# Singleton service factory configuration/IoC injection
service.singletons:
+# StartupHookProvider implementations, there are one to many and they are called in the same sequence defined.
+- com.networknt.server.StartupHookProvider:
+ # registry all service handlers by from annotations
+ - com.networknt.rpc.router.RpcStartupHookProvider
+ @if(config.get("kafkaProducer").booleanValue()){
+ # Kafka producer startup hook example
+ # - net.lightapi.portal.user.command.UserCommandStartup
+ }
+ @if(config.get("kafkaConsumer").booleanValue()){
+ # Kafka consumer startup hook example
+ # - net.lightapi.portal.user.query.UserQueryStartup
+ }
+# ShutdownHookProvider implementations, there are one to many and they are called in the same sequence defined.
+- com.networknt.server.ShutdownHookProvider:
+ @if(config.get("kafkaProducer").booleanValue()){
+ # Kafka producer startup hook example
+ # - net.lightapi.portal.user.command.UserCommandShutdown
+ }
+ @if(config.get("kafkaConsumer").booleanValue()){
+ # Kafka consumer startup hook example
+ # - net.lightapi.portal.user.query.UserQueryShutdown
+ }
+@if(config.get("kafkaProducer").booleanValue()){
+# Kafka Producer instance
+- com.networknt.kafka.producer.NativeLightProducer:
+ - com.networknt.kafka.producer.SidecarProducer
+}
+@if(config.get("kafkaStreams").booleanValue()){
+- com.networknt.kafka.streams.LightStreams:
+ # Kafka streams processor example
+ # - net.lightapi.portal.user.query.UserQueryStreams
+}
+@if(config.get("kafkaStreams").booleanValue()||config.get("kafkaProducer").booleanValue()||config.get("kafkaConsumer").booleanValue()){
+# Schema registry client
+- io.confluent.kafka.schemaregistry.client.SchemaRegistryClient:
+ - com.networknt.kafka.common.LightSchemaRegistryClient
+}
diff --git a/light-hybrid-4j/src/test/java/com/networknt/codegen/hybrid/HybridServiceGeneratorTest.java b/light-hybrid-4j/src/test/java/com/networknt/codegen/hybrid/HybridServiceGeneratorTest.java
index 20fdb7660..40ec7dae8 100644
--- a/light-hybrid-4j/src/test/java/com/networknt/codegen/hybrid/HybridServiceGeneratorTest.java
+++ b/light-hybrid-4j/src/test/java/com/networknt/codegen/hybrid/HybridServiceGeneratorTest.java
@@ -15,8 +15,8 @@
*/
public class HybridServiceGeneratorTest {
public static String targetPath = "/tmp/hybridservice";
- public static String configName = "/serviceConfig.json";
- public static String schemaName = "/schema.json";
+ public static String configName = "/service.yaml";
+ public static String schemaName = "/spec.yaml";
@BeforeAll
public static void setUp() throws IOException {
@@ -31,8 +31,8 @@ public static void tearDown() throws IOException {
@Test
public void testGenerator() throws IOException {
- JsonNode config = Generator.jsonMapper.readTree(HybridServiceGeneratorTest.class.getResourceAsStream(configName));
- JsonNode model = Generator.jsonMapper.readTree(HybridServiceGeneratorTest.class.getResourceAsStream(schemaName));
+ JsonNode config = Generator.yamlMapper.readTree(HybridServiceGeneratorTest.class.getResourceAsStream(configName));
+ JsonNode model = Generator.yamlMapper.readTree(HybridServiceGeneratorTest.class.getResourceAsStream(schemaName));
HybridServiceGenerator generator = new HybridServiceGenerator();
generator.generate(targetPath, model, config);
}
diff --git a/light-hybrid-4j/src/test/resources/logback-test.xml b/light-hybrid-4j/src/test/resources/logback-test.xml
index 6b5cdba65..bf032058c 100644
--- a/light-hybrid-4j/src/test/resources/logback-test.xml
+++ b/light-hybrid-4j/src/test/resources/logback-test.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/light-hybrid-4j/src/test/resources/schema.json b/light-hybrid-4j/src/test/resources/schema.json
deleted file mode 100644
index 60194d996..000000000
--- a/light-hybrid-4j/src/test/resources/schema.json
+++ /dev/null
@@ -1,105 +0,0 @@
-{
- "host": "lightapi.net",
- "service": "world",
- "action": [
- {
- "name": "hello",
- "version": "0.1.0",
- "handler": "HelloWorld1",
- "scope" : "world.r",
- "schema": {
- "title": "Service",
- "type": "object",
- "properties": {
- "firstName": {
- "type": "string"
- },
- "lastName": {
- "type": "string"
- },
- "age": {
- "description": "Age in years",
- "type": "integer",
- "minimum": 0
- }
- },
- "required": ["firstName", "lastName"]
- },
- "example": {"message": "Hello World"}
- },
- {
- "name": "hello",
- "version": "0.1.1",
- "handler": "HelloWorld2",
- "scope" : "world.r",
- "schema": {
- "title": "Service",
- "type": "object",
- "properties": {
- "firstName": {
- "type": "string"
- },
- "lastName": {
- "type": "string"
- },
- "age": {
- "description": "Age in years",
- "type": "integer",
- "minimum": 0
- }
- },
- "required": ["firstName", "lastName"]
- },
- "example": [{"message": "Hello World"}]
- },
- {
- "name": "hi",
- "version": "0.0.1",
- "handler": "HiWorld",
- "scope" : "world.r",
- "schema": {
- "title": "Service",
- "type": "object",
- "properties": {
- "firstName": {
- "type": "string"
- },
- "lastName": {
- "type": "string"
- },
- "age": {
- "description": "Age in years",
- "type": "integer",
- "minimum": 0
- }
- },
- "required": ["firstName", "lastName"]
- },
- "example": [{"message": "Hello World"},{"message": "Hi World"}]
- },
- {
- "name": "welcome",
- "version": "0.0.1",
- "handler": "WelcomeWorld",
- "scope" : "world.w",
- "schema": {
- "title": "Service",
- "type": "object",
- "properties": {
- "firstName": {
- "type": "string"
- },
- "lastName": {
- "type": "string"
- },
- "age": {
- "description": "Age in years",
- "type": "integer",
- "minimum": 0
- }
- },
- "required": ["firstName", "lastName"]
- }
- }
- ]
-}
diff --git a/light-hybrid-4j/src/test/resources/service.yaml b/light-hybrid-4j/src/test/resources/service.yaml
new file mode 100644
index 000000000..2d8da6817
--- /dev/null
+++ b/light-hybrid-4j/src/test/resources/service.yaml
@@ -0,0 +1,27 @@
+---
+name: rule-command
+version: 1.0.1
+groupId: net.lightapi
+artifactId: rule-command
+rootPackage: com.networknt.rule
+handlerPackage: com.networknt.rule.handler
+modelPackage: com.networknt.rule.model
+overwriteHandler: true
+overwriteHandlerTest: true
+httpPort: 8080
+enableHttp: true
+httpsPort: 8443
+enableHttps: false
+enableHttp2: false
+enableRegistry: false
+supportDb: true
+jsonPath: "/portal/command"
+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: false
+buildMaven: true
diff --git a/light-hybrid-4j/src/test/resources/spec.yaml b/light-hybrid-4j/src/test/resources/spec.yaml
new file mode 100644
index 000000000..3aaf753b2
--- /dev/null
+++ b/light-hybrid-4j/src/test/resources/spec.yaml
@@ -0,0 +1,306 @@
+---
+host: lightapi.net
+service: rule
+action:
+ - name: createRule
+ version: 0.1.0
+ handler: CreateRule
+ scope: portal.w
+ request:
+ schema:
+ $ref: "#/schemas/createRuleRequest"
+ example:
+ hostId: "host123"
+ ruleId: "rule456"
+ ruleName: "My New Rule"
+ ruleVersion: "1.0"
+ ruleType: "Authorization"
+ ruleGroup: "Security"
+ ruleDesc: "This is a rule description for my new rule"
+ ruleOwner: "admin"
+ common: "Y"
+ conditions:
+ - field: "user_type"
+ operator: "equals"
+ value: "employee"
+ - field: "department"
+ operator: "contains"
+ value: "IT"
+ response:
+ schema:
+ $ref: "#/schemas/createRuleResponse"
+ example:
+ hostId: "host123"
+ ruleId: "rule456"
+ ruleName: "My New Rule"
+ ruleVersion: "1.0"
+ ruleType: "Authorization"
+ ruleGroup: "Security"
+ ruleDesc: "This is a rule description for my new rule"
+ ruleOwner: "admin"
+ common: "Y"
+ conditions:
+ - field: "user_type"
+ operator: "equals"
+ value: "employee"
+ - field: "department"
+ operator: "contains"
+ value: "IT"
+ - name: updateRule
+ version: 0.1.0
+ handler: UpdateRule
+ scope: portal.w
+ request:
+ schema:
+ $ref: "#/schemas/updateRuleRequest"
+ example:
+ ruleId: "rule456"
+ ruleName: "Updated Rule Name"
+ ruleVersion: "1.1"
+ ruleType: "Validation"
+ ruleGroup: "Compliance"
+ ruleDesc: "Updated rule description"
+ ruleOwner: "manager"
+ common: "N"
+ conditions:
+ - field: "status"
+ operator: "not_equals"
+ value: "pending"
+ response:
+ schema:
+ $ref: "#/schemas/updateRuleResponse"
+ example:
+ ruleId: "rule456"
+ ruleName: "Updated Rule Name"
+ ruleVersion: "1.1"
+ ruleType: "Validation"
+ ruleGroup: "Compliance"
+ ruleDesc: "Updated rule description"
+ ruleOwner: "manager"
+ common: "N"
+ conditions:
+ - field: "status"
+ operator: "not_equals"
+ value: "pending"
+
+ - name: deleteRule
+ version: 0.1.0
+ handler: DeleteRule
+ scope: portal.w
+ request:
+ schema:
+ $ref: "#/schemas/deleteRuleRequest"
+ example:
+ hostId: "host123"
+ ruleId: "rule456"
+ response:
+ schema:
+ $ref: "#/schemas/deleteRuleResponse"
+ example:
+ hostId: "host123"
+ ruleId: "rule456"
+schemas:
+ createRuleRequest:
+ title: Create Rule
+ type: object
+ properties:
+ hostId:
+ type: string
+ description: Host Id
+ ruleId:
+ type: string
+ description: Rule id
+ ruleName:
+ type: string
+ description: Rule Name
+ ruleVersion:
+ type: string
+ description: Rule Version
+ ruleType:
+ type: string
+ description: Rule Type
+ ruleGroup:
+ type: string
+ description: Rule Group
+ ruleDesc:
+ type: string
+ description: Rule desc
+ ruleOwner:
+ type: string
+ description: Rule Owner
+ common:
+ type: string
+ enum:
+ - Y
+ - N
+ description: Common
+ conditions:
+ type: array
+ items:
+ type: object
+ description: Rule Conditions
+ required:
+ - hostId
+ - ruleId
+ - ruleName
+ - ruleVersion
+ - ruleType
+ - ruleOwner
+ - common
+ - conditions
+ createRuleResponse:
+ title: Create Rule
+ type: object
+ properties:
+ hostId:
+ type: string
+ description: Host Id
+ ruleId:
+ type: string
+ description: Rule id
+ ruleName:
+ type: string
+ description: Rule Name
+ ruleVersion:
+ type: string
+ description: Rule Version
+ ruleType:
+ type: string
+ description: Rule Type
+ ruleGroup:
+ type: string
+ description: Rule Group
+ ruleDesc:
+ type: string
+ description: Rule desc
+ ruleOwner:
+ type: string
+ description: Rule Owner
+ common:
+ type: string
+ enum:
+ - Y
+ - N
+ description: Common
+ conditions:
+ type: array
+ items:
+ type: object
+ description: Rule Conditions
+ required:
+ - hostId
+ - ruleId
+ - ruleName
+ - ruleVersion
+ - ruleType
+ - ruleOwner
+ - common
+ - conditions
+ updateRuleRequest:
+ title: Update Rule
+ type: object
+ properties:
+ ruleId:
+ type: string
+ description: Rule id
+ ruleName:
+ type: string
+ description: Rule Name
+ ruleVersion:
+ type: string
+ description: Rule Version
+ ruleType:
+ type: string
+ description: Rule Type
+ ruleGroup:
+ type: string
+ description: Rule Group
+ ruleDesc:
+ type: string
+ description: Rule Desc
+ ruleOwner:
+ type: string
+ description: Rule Owner
+ common:
+ type: string
+ description: Common Flag
+ conditions:
+ type: array
+ items:
+ type: object
+ description: Rule Conditions
+ required:
+ - ruleId
+ - ruleName
+ - ruleVersion
+ - ruleType
+ - ruleOwner
+ - common
+ - conditions
+ updateRuleResponse:
+ title: Update Rule
+ type: object
+ properties:
+ ruleId:
+ type: string
+ description: Rule id
+ ruleName:
+ type: string
+ description: Rule Name
+ ruleVersion:
+ type: string
+ description: Rule Version
+ ruleType:
+ type: string
+ description: Rule Type
+ ruleGroup:
+ type: string
+ description: Rule Group
+ ruleDesc:
+ type: string
+ description: Rule Desc
+ ruleOwner:
+ type: string
+ description: Rule Owner
+ common:
+ type: string
+ description: Common Flag
+ conditions:
+ type: array
+ items:
+ type: object
+ description: Rule Conditions
+ required:
+ - ruleId
+ - ruleName
+ - ruleVersion
+ - ruleType
+ - ruleOwner
+ - common
+ - conditions
+ deleteRuleRequest:
+ title: Delete Rule
+ type: object
+ properties:
+ hostId:
+ type: string
+ description: Host Id
+ ruleId:
+ type: string
+ description: Rule Id
+ required:
+ - hostId
+ - ruleId
+ deleteRuleResponse:
+ title: Delete Rule
+ type: object
+ properties:
+ hostId:
+ type: string
+ description: Host Id
+ ruleId:
+ type: string
+ description: Rule Id
+ required:
+ - hostId
+ - ruleId
diff --git a/light-rest-4j/pom.xml b/light-rest-4j/pom.xml
index 4eb990281..e890898ff 100644
--- a/light-rest-4j/pom.xml
+++ b/light-rest-4j/pom.xml
@@ -21,12 +21,13 @@
com.networknt
light-codegen
- 2.1.36
+ 2.3.2-SNAPSHOT
../pom.xml
light-rest-4j-generator
jar
+ light-rest-4j-generator
light-rest-4j code generator.
diff --git a/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiKotlinGenerator.java b/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiKotlinGenerator.java
index 1f9fcaed8..64d93a5ad 100644
--- a/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiKotlinGenerator.java
+++ b/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiKotlinGenerator.java
@@ -120,9 +120,6 @@ public void generate(String targetPath, Object model, JsonNode config) throws IO
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "openapi-security.yml", templates.restkotlin.openapiSecurity.template());
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "openapi-validator.yml", templates.restkotlin.openapiValidator.template());
- transfer(targetPath, ("src.main.resources.config").replace(".", separator), "primary.crt", templates.restkotlin.primaryCrt.template());
- transfer(targetPath, ("src.main.resources.config").replace(".", separator), "secondary.crt", templates.restkotlin.secondaryCrt.template());
-
// mask
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "mask.yml", templates.restkotlin.maskYml.template());
// logging
diff --git a/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiLambdaGenerator.java b/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiLambdaGenerator.java
index 657fd3e42..6f5edd810 100644
--- a/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiLambdaGenerator.java
+++ b/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiLambdaGenerator.java
@@ -123,8 +123,6 @@ public void generate(final String targetPath, Object model, JsonNode config) thr
}
transfer(targetPath, "proxy", "server.yml", templates.lambda.proxy.server.template(serviceId, enableRegistry, version));
- transfer(targetPath, "proxy", "primary.crt", templates.rest.primaryCrt.template());
- transfer(targetPath, "proxy", "secondary.crt", templates.rest.secondaryCrt.template());
// transfer binary files without touching them.
try (InputStream is = OpenApiLambdaGenerator.class.getResourceAsStream("/binaries/server.keystore")) {
Generator.copyFile(is, Paths.get(targetPath, "proxy", "server.keystore"));
diff --git a/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiLightGenerator.java b/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiLightGenerator.java
index 6812450b3..0ecbc7a6a 100644
--- a/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiLightGenerator.java
+++ b/light-rest-4j/src/main/java/com/networknt/codegen/rest/OpenApiLightGenerator.java
@@ -137,7 +137,7 @@ public void generate(final String targetPath, Object model, JsonNode config) thr
transfer(targetPath, "docker", "Dockerfile", templates.rest.dockerfile.template(config, expose));
transfer(targetPath, "docker", "Dockerfile-Slim", templates.rest.dockerfileslim.template(config, expose));
- transfer(targetPath, "", "build.sh", templates.rest.buildSh.template(config, serviceId));
+ transfer(targetPath, "", "build.sh", templates.rest.buildSh.template(config));
transfer(targetPath, "", "kubernetes.yml", templates.rest.kubernetes.template(dockerOrganization, serviceId, config.get("artifactId").textValue(), expose, version));
transfer(targetPath, "", ".gitignore", templates.rest.gitignore.template());
transfer(targetPath, "", "README.md", templates.rest.README.template(config));
@@ -147,8 +147,6 @@ public void generate(final String targetPath, Object model, JsonNode config) thr
transfer(targetPath, "", ".project", templates.rest.project.template(config));
}
// config
- transfer(targetPath, (configFolder).replace(".", separator), "primary.crt", templates.rest.primaryCrt.template());
- transfer(targetPath, (configFolder).replace(".", separator), "secondary.crt", templates.rest.secondaryCrt.template());
if(kafkaProducer) {
transfer(targetPath, (configFolder).replace(".", separator), "kafka-producer.yml", templates.rest.kafkaProducerYml.template(kafkaTopic));
}
diff --git a/light-rest-4j/src/main/resources/binaries/client.keystore b/light-rest-4j/src/main/resources/binaries/client.keystore
index c593b3758..7e8c001d4 100644
Binary files a/light-rest-4j/src/main/resources/binaries/client.keystore and b/light-rest-4j/src/main/resources/binaries/client.keystore differ
diff --git a/light-rest-4j/src/main/resources/binaries/client.truststore b/light-rest-4j/src/main/resources/binaries/client.truststore
index ded19d0cd..85c8aaff4 100644
Binary files a/light-rest-4j/src/main/resources/binaries/client.truststore and b/light-rest-4j/src/main/resources/binaries/client.truststore differ
diff --git a/light-rest-4j/src/main/resources/binaries/server.keystore b/light-rest-4j/src/main/resources/binaries/server.keystore
index feab9b6d2..d5269b527 100644
Binary files a/light-rest-4j/src/main/resources/binaries/server.keystore and b/light-rest-4j/src/main/resources/binaries/server.keystore differ
diff --git a/light-rest-4j/src/main/resources/binaries/server.truststore b/light-rest-4j/src/main/resources/binaries/server.truststore
index fb0c19ccb..f30e2d7fb 100644
Binary files a/light-rest-4j/src/main/resources/binaries/server.truststore and b/light-rest-4j/src/main/resources/binaries/server.truststore differ
diff --git a/light-rest-4j/src/main/resources/templates/lambda/gradleProperties.rocker.raw b/light-rest-4j/src/main/resources/templates/lambda/gradleProperties.rocker.raw
index e09d48025..01d66cfaa 100644
--- a/light-rest-4j/src/main/resources/templates/lambda/gradleProperties.rocker.raw
+++ b/light-rest-4j/src/main/resources/templates/lambda/gradleProperties.rocker.raw
@@ -1,7 +1,7 @@
# Versions of Frequently used Libraries
-light4jVersion=2.1.36
+light4jVersion=2.3.2-SNAPSHOT
lambdaCoreVersion=1.2.3
-lambdaEventsVersion=3.11.6
-jacksonVersion=2.17.1
-logbackVersion=1.5.6
-junitVersion=5.7.0
+lambdaEventsVersion=3.15.0
+jacksonVersion=2.18.3
+logbackVersion=1.5.26
+junitVersion=5.11.3
diff --git a/light-rest-4j/src/main/resources/templates/lambda/pom.xml.rocker.raw b/light-rest-4j/src/main/resources/templates/lambda/pom.xml.rocker.raw
index 737298c21..374d9641c 100644
--- a/light-rest-4j/src/main/resources/templates/lambda/pom.xml.rocker.raw
+++ b/light-rest-4j/src/main/resources/templates/lambda/pom.xml.rocker.raw
@@ -12,15 +12,15 @@
11
11
UTF-8
- 2.1.36
- 2.17.1
- 2.0.13
- 1.5.6
+ 2.3.2-SNAPSHOT
+ 2.18.3
+ 2.0.17
+ 1.5.26
1.5.1
- 2.2
+ 2.4
1.2.3
- 3.11.6
- 5.7.0
+ 3.15.0
+ 5.11.3
diff --git a/light-rest-4j/src/main/resources/templates/lambda/template.yaml.rocker.raw b/light-rest-4j/src/main/resources/templates/lambda/template.yaml.rocker.raw
index 1d9ad3a9c..e642d6d43 100644
--- a/light-rest-4j/src/main/resources/templates/lambda/template.yaml.rocker.raw
+++ b/light-rest-4j/src/main/resources/templates/lambda/template.yaml.rocker.raw
@@ -1,7 +1,7 @@
@import java.util.Map
@import java.util.List
-@import com.networknt.codegen.rest.AbstractLambdaGenerator.OpenApiPath;
-@import com.networknt.codegen.rest.AbstractLambdaGenerator.MethodFunction;
+@import com.networknt.codegen.rest.AbstractLambdaGenerator.OpenApiPath
+@import com.networknt.codegen.rest.AbstractLambdaGenerator.MethodFunction
@args (String projectName, String handlerPackage, boolean packageDocker, boolean useLightProxy, List
-
-
- central
-
- https://oss.sonatype.org/content/repositories/releases
-
-
- false
-
-
-
- snapshots
-
- https://oss.sonatype.org/content/repositories/snapshots
-
-
- true
-
-
-
-
- false
-
-
-
-
@@ -599,6 +581,16 @@
+
+ org.sonatype.central
+ central-publishing-maven-plugin
+ 0.7.0
+ true
+
+ central
+ true
+
+