diff --git a/.github/workflows/deploy-mvn-central-release.yml b/.github/workflows/deploy-mvn-central-release.yml
index c74cd21..32b3609 100644
--- a/.github/workflows/deploy-mvn-central-release.yml
+++ b/.github/workflows/deploy-mvn-central-release.yml
@@ -28,16 +28,16 @@ jobs:
run: |
echo "BRANCH=${{ github.event.inputs.RELEASE_BRANCH || github.ref }}" >> $GITHUB_ENV
- name: Checkout repository code
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH }}
fetch-depth: 0
- name: Setup Java JDK and Maven
- uses: ontimize/setup-java-maven-gitAction@v3
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- server-id: ossrh
+ server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
diff --git a/.github/workflows/deploy-mvn-central-snapshot-manual.yml b/.github/workflows/deploy-mvn-central-snapshot-manual.yml
index f44919d..1c17ca3 100644
--- a/.github/workflows/deploy-mvn-central-snapshot-manual.yml
+++ b/.github/workflows/deploy-mvn-central-snapshot-manual.yml
@@ -17,13 +17,13 @@ jobs:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
steps:
- name : Checkout repository code
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Setup Java JDK and Maven
- uses: ontimize/setup-java-maven-gitAction@v3
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- server-id: ossrh
+ server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
diff --git a/.github/workflows/deploy-mvn-central-snapshot.yml b/.github/workflows/deploy-mvn-central-snapshot.yml
index e44a256..d3f6d4a 100644
--- a/.github/workflows/deploy-mvn-central-snapshot.yml
+++ b/.github/workflows/deploy-mvn-central-snapshot.yml
@@ -13,13 +13,13 @@ jobs:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
steps:
- name : Checkout repository code
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Setup Java JDK and Maven
- uses: ontimize/setup-java-maven-gitAction@v3
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- server-id: ossrh
+ server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
diff --git a/.github/workflows/prepare-release-by-PR.yml b/.github/workflows/prepare-release-by-PR.yml
index 4fff728..711f3da 100644
--- a/.github/workflows/prepare-release-by-PR.yml
+++ b/.github/workflows/prepare-release-by-PR.yml
@@ -18,9 +18,9 @@ jobs:
ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }}
steps:
- name: Checkout repository code
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Setup Java JDK and Maven
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
@@ -38,6 +38,22 @@ jobs:
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ secrets.CI_COMMIT_MAIL }}"
+ - name: Prepare CHANGELOG.md
+ run: |
+ version=$(echo "${{ steps.version.outputs.version }}" | sed 's/-SNAPSHOT//' )
+ date=$(date +%F)
+ version_header="## [$version] - $date"
+ sed -i "/^## \[Unreleased\]/a $version_header" CHANGELOG.md
+ pattern="^\[unreleased\]: https://github.com/.*/compare/"
+ linenum=$(grep -n "$pattern" CHANGELOG.md | cut -d: -f1)
+ linecontent=$(sed -n "${linenum}p" CHANGELOG.md)
+ linecontent=$(echo "$linecontent" | sed -E "s|^\[[^]]+\]|[$version]|")
+ linecontent=$(echo "$linecontent" | sed -E "s|\.\.\.HEAD|...$version|")
+ sed -i "${linenum}a $linecontent" CHANGELOG.md
+ linecontent=$(sed -n "${linenum}p" CHANGELOG.md)
+ linecontent=$(echo "$linecontent" | sed -E "s|(compare/).*?(.\.\.\HEAD)|\1$version\2|")
+ sed -i "${linenum}s|.*|$linecontent|" CHANGELOG.md
+ git add CHANGELOG.md
- name: Prepare version to release
id: tag
run: |
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 89dc04c..c1c9a9d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,9 +9,12 @@
## [Unreleased]
+## [1.3.0] - 2025-06-12
+### Changed 🛠️
+* **OpenAPI generator:**: Upgraded to 6.5.0 version.
## [1.2.0] - 2024-04-12
-
-* **Swagger UI:**: Updated to 5.15 version.
+### Changed 🛠️
+* **Swagger UI:**: Upgraded to 5.15 version.
## [1.1.0] - 2024-03-19
### Fixed 🐛
* **Open API:** Fix ignored parameters issue.
@@ -34,7 +37,8 @@
* **Maven:** Convert to Maven plugin.
-[unreleased]: https://github.com/ontimize/ontimize-openapi-generator/compare/1.2.0...HEAD
+[unreleased]: https://github.com/ontimize/ontimize-openapi-generator/compare/1.3.0...HEAD
+[1.3.0]: https://github.com/ontimize/ontimize-openapi-generator/compare/1.2.0...1.3.0
[1.2.0]: https://github.com/ontimize/ontimize-openapi-generator/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/ontimize/ontimize-openapi-generator/compare/1.0.4...1.1.0
[1.0.4]: https://github.com/ontimize/ontimize-openapi-generator/compare/1.0.3...1.0.4
diff --git a/pom.xml b/pom.xml
index f3c6823..f330d75 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
com.ontimize
ontimize-openapi-generator
- 1.2.0
+ 1.3.0
maven-plugin
Imatia Innovation
@@ -34,20 +34,9 @@
scm:git:git://github.com/ontimize/ontimize-openapi-generator.git
scm:git:ssh://github.com:ontimize/ontimize-openapi-generator.git
- https://github.com/ontimize/ontimize-openapi-generator/tree/master
+ https://github.com/ontimize/ontimize-openapi-generator/tree/main
-
-
- ossrh
- https://s01.oss.sonatype.org/content/repositories/snapshots
-
-
- ossrh
- https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
-
-
-
11
11
@@ -69,10 +58,11 @@
3.6.0
1.6.7
3.0.1
+ 0.7.0
- 4.3.1
+ 6.5.0
4.8.1
3.3.1
3.2.5
@@ -275,14 +265,13 @@
maven-javadoc-plugin
- org.sonatype.plugins
- nexus-staging-maven-plugin
- ${nexus.staging.maven.plugin.version}
+ org.sonatype.central
+ central-publishing-maven-plugin
+ ${central-publishing-maven-plugin.version}
true
- ossrh
- https://s01.oss.sonatype.org/
- true
+ central
+ true
diff --git a/src/main/java/com/ontimize/openapi/CodeGenMojo.java b/src/main/java/com/ontimize/openapi/CodeGenMojo.java
index 9e01656..d314fdd 100644
--- a/src/main/java/com/ontimize/openapi/CodeGenMojo.java
+++ b/src/main/java/com/ontimize/openapi/CodeGenMojo.java
@@ -2,7 +2,7 @@
import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyImportMappingsKvpList;
+import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applySchemaMappingsKvpList;
import java.io.BufferedReader;
import java.io.File;
@@ -11,7 +11,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -37,6 +36,7 @@
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.auth.AuthParser;
import org.openapitools.codegen.config.CodegenConfigurator;
+import org.openapitools.codegen.config.GlobalSettings;
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
import org.sonatype.plexus.build.incremental.BuildContext;
import org.sonatype.plexus.build.incremental.DefaultBuildContext;
@@ -186,16 +186,17 @@ public void execute() throws MojoExecutionException {
.setGeneratorName("ontimize-server")
.setOutputDir(output.getAbsolutePath())
.addAdditionalProperty(CodegenConstants.SOURCE_FOLDER, "java")
- .addSystemProperty(CodegenConstants.MODELS, "") // Empty means "All models"
- .addSystemProperty(CodegenConstants.APIS, "") // Empty means "All APIs"
.addAdditionalProperty(BeanValidationFeatures.USE_BEANVALIDATION, this.useBeanValidation);
+ GlobalSettings.setProperty(CodegenConstants.MODELS, ""); // Process all models
+ GlobalSettings.setProperty(CodegenConstants.APIS, ""); // Process all APIs
+
if (isNotEmpty(this.auth)) {
configurator.setAuth(this.auth);
}
if (this.importMappings != null) {
- applyImportMappingsKvpList(this.importMappings, configurator);
+ applySchemaMappingsKvpList(this.importMappings, configurator);
}
if (isNotEmpty(this.packageName)) {
diff --git a/src/main/java/com/ontimize/openapi/ServerCodegen.java b/src/main/java/com/ontimize/openapi/ServerCodegen.java
index bd89adf..b88e02c 100644
--- a/src/main/java/com/ontimize/openapi/ServerCodegen.java
+++ b/src/main/java/com/ontimize/openapi/ServerCodegen.java
@@ -280,7 +280,8 @@ public String getSchemaType(Schema p) {
if (this.modelPackage != null && !this.modelPackage.isEmpty()
&& !this.modelPackage.equals(this.apiPackage)
&& !this.typeMapping.containsValue(openAPIType)
- && !this.importMapping.containsValue(openAPIType)) {
+ && !this.importMapping.containsValue(openAPIType)
+ && !this.schemaMapping.containsValue(openAPIType)) {
openAPIType = this.modelPackage + "." + openAPIType;
}
@@ -296,7 +297,8 @@ public String getTypeDeclaration(String name) {
if (this.modelPackage != null && !this.modelPackage.isEmpty()
&& !this.modelPackage.equals(this.apiPackage)
&& !this.typeMapping.containsValue(typeDeclaration)
- && !this.importMapping.containsValue(typeDeclaration)) {
+ && !this.importMapping.containsValue(typeDeclaration)
+ && !this.schemaMapping.containsValue(typeDeclaration)) {
typeDeclaration = this.modelPackage + "." + typeDeclaration;
}
@@ -414,26 +416,26 @@ public void processOpts() {
this.importMapping.put("Void", "java.lang.Void");
/*
- this.importMapping.put("AdvancedEntityResult", "com.ontimize.db.AdvancedEntityResult");
- this.importMapping.put("EntityResult", "com.ontimize.db.EntityResult");
+ this.schemaMapping.put("AdvancedEntityResult", "com.ontimize.db.AdvancedEntityResult");
+ this.schemaMapping.put("EntityResult", "com.ontimize.db.EntityResult");
*/
- this.importMapping.put("AdvancedEntityResult", "com.ontimize.jee.common.db.AdvancedEntityResult");
- this.importMapping.put("EntityResult", "com.ontimize.jee.common.dto.EntityResult");
+ this.schemaMapping.put("AdvancedEntityResult", "com.ontimize.jee.common.db.AdvancedEntityResult");
+ this.schemaMapping.put("EntityResult", "com.ontimize.jee.common.dto.EntityResult");
- this.importMapping.put("AdvancedQueryParameter", "com.ontimize.jee.server.rest.AdvancedQueryParameter");
- this.importMapping.put("DeleteParameter", "com.ontimize.jee.server.rest.DeleteParameter");
- this.importMapping.put("FileListParameter", "com.ontimize.jee.server.rest.FileListParameter");
- this.importMapping.put("InsertParameter", "com.ontimize.jee.server.rest.InsertParameter");
- this.importMapping.put("QueryParameter", "com.ontimize.jee.server.rest.QueryParameter");
- this.importMapping.put("UpdateFileParameter", "com.ontimize.jee.server.rest.UpdateFileParameter");
- this.importMapping.put("UpdateParameter", "com.ontimize.jee.server.rest.UpdateParameter");
+ this.schemaMapping.put("AdvancedQueryParameter", "com.ontimize.jee.server.rest.AdvancedQueryParameter");
+ this.schemaMapping.put("DeleteParameter", "com.ontimize.jee.server.rest.DeleteParameter");
+ this.schemaMapping.put("FileListParameter", "com.ontimize.jee.server.rest.FileListParameter");
+ this.schemaMapping.put("InsertParameter", "com.ontimize.jee.server.rest.InsertParameter");
+ this.schemaMapping.put("QueryParameter", "com.ontimize.jee.server.rest.QueryParameter");
+ this.schemaMapping.put("UpdateFileParameter", "com.ontimize.jee.server.rest.UpdateFileParameter");
+ this.schemaMapping.put("UpdateParameter", "com.ontimize.jee.server.rest.UpdateParameter");
- this.importMapping.put("ExportParameter", "com.ontimize.jee.webclient.export.ExportParameter");
+ this.schemaMapping.put("ExportParameter", "com.ontimize.jee.webclient.export.ExportParameter");
- this.importMapping.put("OFile", "com.ontimize.jee.server.dms.model.OFile");
- this.importMapping.put("DocumentIdentifier", "com.ontimize.jee.common.services.dms.DocumentIdentifier");
+ this.schemaMapping.put("OFile", "com.ontimize.jee.server.dms.model.OFile");
+ this.schemaMapping.put("DocumentIdentifier", "com.ontimize.jee.common.services.dms.DocumentIdentifier");
- this.importMapping.put("SQLOrder", "com.ontimize.db.SQLStatementBuilder.SQLOrder");
+ this.schemaMapping.put("SQLOrder", "com.ontimize.db.SQLStatementBuilder.SQLOrder");
}
/*
diff --git a/src/main/resources/ontimize-server/api.mustache b/src/main/resources/ontimize-server/api.mustache
index 9c0e4cf..710011e 100644
--- a/src/main/resources/ontimize-server/api.mustache
+++ b/src/main/resources/ontimize-server/api.mustache
@@ -40,13 +40,13 @@ public interface {{classname}} {
@Deprecated
{{/isDeprecated}}
{{^vendorExtensions.x-restcontroller}}@RequestMapping(path = "{{path}}", method = RequestMethod.{{httpMethod}}{{#hasConsumes}},
- consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }{{/hasConsumes}}{{#hasProduces}},
- produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }{{/hasProduces}}){{/vendorExtensions.x-restcontroller}}
- public {{>returnType}} {{operationId}}({{#vendorExtensions.x-restcontroller}}{{#allParams}}{{>baseParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{/vendorExtensions.x-restcontroller}}{{^vendorExtensions.x-restcontroller}}{{#allParams}}{{>pathParams}}{{>queryParams}}{{>formParams}}{{>bodyParams}}{{>internalParams}}{{#hasMore}},
- {{/hasMore}}{{/allParams}}{{/vendorExtensions.x-restcontroller}}){{#vendorExtensions.x-throws}} throws {{vendorExtensions.x-throws}}{{/vendorExtensions.x-throws}};
- {{#hasMore}}
+ consumes = { {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }{{/hasConsumes}}{{#hasProduces}},
+ produces = { {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }{{/hasProduces}}){{/vendorExtensions.x-restcontroller}}
+ public {{>returnType}} {{operationId}}({{#vendorExtensions.x-restcontroller}}{{#allParams}}{{>baseParams}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-restcontroller}}{{^vendorExtensions.x-restcontroller}}{{#allParams}}{{>pathParams}}{{>queryParams}}{{>formParams}}{{>bodyParams}}{{>internalParams}}{{^-last}},
+ {{/-last}}{{/allParams}}{{/vendorExtensions.x-restcontroller}}){{#vendorExtensions.x-throws}} throws {{vendorExtensions.x-throws}}{{/vendorExtensions.x-throws}};
+ {{^-last}}
- {{/hasMore}}
+ {{/-last}}
{{/operation}}
}
{{/operations}}
diff --git a/src/main/resources/ontimize-server/model.mustache b/src/main/resources/ontimize-server/model.mustache
index ece6c41..e1c6ecf 100644
--- a/src/main/resources/ontimize-server/model.mustache
+++ b/src/main/resources/ontimize-server/model.mustache
@@ -3,9 +3,6 @@ package {{package}};
import java.util.Objects;
{{#imports}}import {{import}};
{{/imports}}
-{{#openApiNullable}}
-import org.openapitools.jackson.nullable.JsonNullable;
-{{/openApiNullable}}
{{#serializableModel}}
import java.io.Serializable;
{{/serializableModel}}
diff --git a/src/main/resources/ontimize-server/pojo.mustache b/src/main/resources/ontimize-server/pojo.mustache
index ca1b09c..38af515 100644
--- a/src/main/resources/ontimize-server/pojo.mustache
+++ b/src/main/resources/ontimize-server/pojo.mustache
@@ -132,15 +132,15 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{^parent}}
return false;
}{{#hasVars}}
{{classname}} {{classVarName}} = ({{classname}}) o;
- return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
- {{/hasMore}}{{/vars}}{{#parent}} &&
+ return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} &&
+ {{/-last}}{{/vars}}{{#parent}} &&
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
return true;{{/hasVars}}
}
@Override
public int hashCode() {
- return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
+ return Objects.hash({{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
}
@Override
diff --git a/src/test/java/com/ontimize/openapi/ServerCodegenTest.java b/src/test/java/com/ontimize/openapi/ServerCodegenTest.java
index 9314bf8..1f2c141 100644
--- a/src/test/java/com/ontimize/openapi/ServerCodegenTest.java
+++ b/src/test/java/com/ontimize/openapi/ServerCodegenTest.java
@@ -5,6 +5,7 @@
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.config.CodegenConfigurator;
+import org.openapitools.codegen.config.GlobalSettings;
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
/***
@@ -29,14 +30,15 @@ public void launchCodeGenerator() {
.setGeneratorName("ontimize-server") // use this codegen library
.setInputSpec("src/test/resources/rest/openapi-rest.yml") // sample OpenAPI file
// .setInputSpec("https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml") // or from the server
- .addSystemProperty(CodegenConstants.MODELS, "") // Process all models
- .addSystemProperty(CodegenConstants.APIS, "") // Process all APIs
.addAdditionalProperty(CodegenConstants.SOURCE_FOLDER, "")
.addAdditionalProperty(BeanValidationFeatures.USE_BEANVALIDATION, true)
.setApiPackage("service")
.setModelPackage("model")
.setOutputDir("target/generated-sources"); // output directory
+ GlobalSettings.setProperty(CodegenConstants.MODELS, ""); // Process all models
+ GlobalSettings.setProperty(CodegenConstants.APIS, ""); // Process all APIs
+
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();