-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Support for KumuluzEE microprofile runtime #5944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5ac14b8
Added library and edited generator to support server stub generation …
6dd9802
Trimmed and tweaked pom.xml template and removed unnecessary template…
49e8a0a
minor edits
jmezna 580f666
Added new library to Java client codegen (microprofile-kumuluzee). A
chuckle-dog 0e3233a
Merge branch 'master' of https://github.com/chuckle-dog/openapi-gener…
chuckle-dog 42ada37
Edited README for microprofile-kumuluzee
chuckle-dog 97b569c
Synced with remote master, resolved merge conflicts.
chuckle-dog dc1c3d4
Edited docs to include new KumuluzEE library options.
chuckle-dog f994ddd
Updated kee-rest-client client POM dependency version to latest
chuckle-dog 741c256
fixed pom, edited REAMDE
jmezna 6321cea
Trimmed redundant dependencies from KEE client pom
chuckle-dog 56fef6d
Removed unnecessary DefaultGenerator edit, modified config template a…
chuckle-dog db0d79d
Merge branch 'master' into master
chuckle-dog 30e3818
Made mp framework an additional property for microprofile instead of …
chuckle-dog ad63749
Merge branch 'master' of https://github.com/chuckle-dog/openapi-gener…
chuckle-dog b0ad1c6
Updated documentation with microprofile framework
chuckle-dog 443f3f6
Merge branch 'master' into master
chuckle-dog 176166b
Merge branch 'master' into master
chuckle-dog 5b27252
Fixed errors caused by removed functions and variables
chuckle-dog 203b62f
update doc
wing328 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| import org.apache.commons.lang3.BooleanUtils; | ||
| import org.apache.commons.lang3.StringUtils; | ||
| import org.openapitools.codegen.*; | ||
| import org.openapitools.codegen.config.GlobalSettings; | ||
| import org.openapitools.codegen.languages.features.BeanValidationFeatures; | ||
| import org.openapitools.codegen.languages.features.GzipFeatures; | ||
| import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures; | ||
|
|
@@ -60,12 +61,16 @@ public class JavaClientCodegen extends AbstractJavaCodegen | |
| public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException"; | ||
| public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode"; | ||
| public static final String CASE_INSENSITIVE_RESPONSE_HEADERS = "caseInsensitiveResponseHeaders"; | ||
| public static final String MICROPROFILE_FRAMEWORK = "microprofileFramework"; | ||
| public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles"; | ||
|
|
||
| public static final String PLAY_24 = "play24"; | ||
| public static final String PLAY_25 = "play25"; | ||
| public static final String PLAY_26 = "play26"; | ||
|
|
||
| public static final String MICROPROFILE_DEFAULT = "default"; | ||
| public static final String MICROPROFILE_KUMULUZEE = "kumuluzee"; | ||
|
|
||
| public static final String FEIGN = "feign"; | ||
| public static final String GOOGLE_API_CLIENT = "google-api-client"; | ||
| public static final String JERSEY1 = "jersey1"; | ||
|
|
@@ -91,7 +96,9 @@ public class JavaClientCodegen extends AbstractJavaCodegen | |
| // (mustache does not allow for boolean operators so we need this extra field) | ||
| protected boolean doNotUseRx = true; | ||
| protected boolean usePlayWS = false; | ||
| protected String playVersion = PLAY_26; | ||
| protected String playVersion = PLAY_25; | ||
| protected String microprofileFramework = MICROPROFILE_DEFAULT; | ||
|
|
||
| protected boolean asyncNative = false; | ||
| protected boolean parcelableModel = false; | ||
| protected boolean useBeanValidation = false; | ||
|
|
@@ -142,6 +149,7 @@ public JavaClientCodegen() { | |
| cliOptions.add(CliOption.newBoolean(ASYNC_NATIVE, "If true, async handlers will be used, instead of the sync version")); | ||
| cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.")); | ||
| cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries")); | ||
| cliOptions.add(CliOption.newString(MICROPROFILE_FRAMEWORK, "Framework for microprofile. Possible values \"kumuluzee\"")); | ||
| cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on " + RESTTEMPLATE + " library")); | ||
|
|
||
| supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead."); | ||
|
|
@@ -158,6 +166,7 @@ public JavaClientCodegen() { | |
| supportedLibraries.put(NATIVE, "HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+"); | ||
| supportedLibraries.put(MICROPROFILE, "HTTP client: Microprofile client 1.x. JSON processing: Jackson 2.9.x"); | ||
|
|
||
|
|
||
| CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); | ||
| libraryOption.setEnum(supportedLibraries); | ||
| // set okhttp-gson as the default | ||
|
|
@@ -209,7 +218,6 @@ public void processOpts() { | |
| } else if (MICROPROFILE.equals(getLibrary()) && "threetenbp".equals(dateLibrary)) { | ||
| dateLibrary = "legacy"; | ||
| } | ||
|
|
||
| super.processOpts(); | ||
|
|
||
| // RxJava | ||
|
|
@@ -254,6 +262,17 @@ public void processOpts() { | |
| } | ||
| additionalProperties.put(PLAY_VERSION, playVersion); | ||
|
|
||
| // Microprofile framework | ||
| if (additionalProperties.containsKey(MICROPROFILE_FRAMEWORK)) { | ||
| this.setMicroprofileFramework(additionalProperties.get(MICROPROFILE_FRAMEWORK).toString()); | ||
|
|
||
| if (!MICROPROFILE_KUMULUZEE.equals(microprofileFramework)) { | ||
| throw new RuntimeException("Ivalid microprofileFramework '{}'. Must be 'kumuluzee' or none."); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll fix the typo (Ivalid => Invalid) and string interpolation '{}' in another PR. |
||
| } | ||
|
|
||
| } | ||
| additionalProperties.put(MICROPROFILE_FRAMEWORK, microprofileFramework); | ||
|
|
||
| if (additionalProperties.containsKey(ASYNC_NATIVE)) { | ||
| this.setAsyncNative(convertPropertyToBooleanAndWriteBack(ASYNC_NATIVE)); | ||
| } | ||
|
|
@@ -448,6 +467,12 @@ public void processOpts() { | |
| supportingFiles.add(new SupportingFile("api_exception.mustache", apiExceptionFolder, "ApiException.java")); | ||
| supportingFiles.add(new SupportingFile("api_exception_mapper.mustache", apiExceptionFolder, "ApiExceptionMapper.java")); | ||
| serializationLibrary = "none"; | ||
|
|
||
| if (microprofileFramework.equals(MICROPROFILE_KUMULUZEE)){ | ||
| supportingFiles.add(new SupportingFile("kumuluzee.pom.mustache", "", "pom.xml")); | ||
| supportingFiles.add(new SupportingFile("kumuluzee.config.yaml.mustache", "src/main/resources", "config.yaml")); | ||
| supportingFiles.add(new SupportingFile("kumuluzee.beans.xml.mustache", "src/main/resources/META-INF", "beans.xml")); | ||
| } | ||
| } else { | ||
| LOGGER.error("Unknown library option (-l/--library): " + getLibrary()); | ||
| } | ||
|
|
@@ -843,6 +868,10 @@ public void setAsyncNative(boolean asyncNative) { | |
| this.asyncNative = asyncNative; | ||
| } | ||
|
|
||
| public void setMicroprofileFramework(String microprofileFramework) { | ||
| this.microprofileFramework = microprofileFramework; | ||
| } | ||
|
|
||
| public void setParcelableModel(boolean parcelableModel) { | ||
| this.parcelableModel = parcelableModel; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...api-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.beans.xml.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_2.xsd" | ||
| bean-discovery-mode="annotated"> | ||
| </beans> |
10 changes: 10 additions & 0 deletions
10
...i-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.config.yaml.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| kumuluzee: | ||
| server: | ||
| http: | ||
| port: 8081 | ||
|
|
||
| rest-client: | ||
| registrations: | ||
| {{#apiInfo}}{{#apis}}{{#operations}}- class: {{{invokerPackage}}}.{{{classname}}} | ||
| url: http://localhost:8080/v2 | ||
| {{/operations}}{{/apis}}{{/apiInfo}} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change it back to PLAY_26 as the default play version in another PR.