From bbe13247e245cde67bd97c5c9530f66858fd458f Mon Sep 17 00:00:00 2001 From: frantuma Date: Tue, 15 Oct 2024 12:02:59 +0200 Subject: [PATCH 01/13] refs #1308 - fix jakarta spring generator --- .../v3/generators/java/SpringCodegen.java | 2 ++ .../JavaSpring/NotUndefined.mustache | 6 ++++++ .../JavaSpring/NotUndefinedValidator.mustache | 6 ++++++ .../customInstantDeserializer.mustache | 6 ++++++ .../libraries/spring-boot/pom.mustache | 19 ++++++++++++++++++- .../spring-boot/swagger2SpringBoot.mustache | 11 ++++++++++- .../libraries/spring-boot3/pom.mustache | 11 ++++++++--- .../generators/java/SpringGeneratorTest.java | 2 ++ 8 files changed, 58 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/swagger/codegen/v3/generators/java/SpringCodegen.java b/src/main/java/io/swagger/codegen/v3/generators/java/SpringCodegen.java index 968e672084..ce31cc6c0d 100644 --- a/src/main/java/io/swagger/codegen/v3/generators/java/SpringCodegen.java +++ b/src/main/java/io/swagger/codegen/v3/generators/java/SpringCodegen.java @@ -233,6 +233,8 @@ public void processOpts() { if (isSpringBoot3Library()) { setDateLibrary("java8"); + setJakarta(true); + additionalProperties.put(JAKARTA, jakarta); } super.processOpts(); diff --git a/src/main/resources/handlebars/JavaSpring/NotUndefined.mustache b/src/main/resources/handlebars/JavaSpring/NotUndefined.mustache index be3adc1b42..d63b6e2c46 100644 --- a/src/main/resources/handlebars/JavaSpring/NotUndefined.mustache +++ b/src/main/resources/handlebars/JavaSpring/NotUndefined.mustache @@ -1,7 +1,13 @@ package {{configPackage}}; +{{#jakarta}} +import jakarta.validation.Constraint; +import jakarta.validation.Payload; +{{/jakarta}} +{{^jakarta}} import javax.validation.Constraint; import javax.validation.Payload; +{{/jakarta}} import java.lang.annotation.*; @Target({ElementType.TYPE}) diff --git a/src/main/resources/handlebars/JavaSpring/NotUndefinedValidator.mustache b/src/main/resources/handlebars/JavaSpring/NotUndefinedValidator.mustache index 92dc13018e..d143f20907 100644 --- a/src/main/resources/handlebars/JavaSpring/NotUndefinedValidator.mustache +++ b/src/main/resources/handlebars/JavaSpring/NotUndefinedValidator.mustache @@ -1,8 +1,14 @@ package {{configPackage}}; import org.openapitools.jackson.nullable.JsonNullable; +{{#jakarta}} +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; +{{/jakarta}} +{{^jakarta}} import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; +{{/jakarta}} import java.lang.reflect.Field; public class NotUndefinedValidator implements ConstraintValidator{ diff --git a/src/main/resources/handlebars/JavaSpring/customInstantDeserializer.mustache b/src/main/resources/handlebars/JavaSpring/customInstantDeserializer.mustache index da7b57a613..0ac2179487 100644 --- a/src/main/resources/handlebars/JavaSpring/customInstantDeserializer.mustache +++ b/src/main/resources/handlebars/JavaSpring/customInstantDeserializer.mustache @@ -200,7 +200,13 @@ public class CustomInstantDeserializer return value; } } + {{#jakarta}} + context.reportInputMismatch(handledType(), "Expected type float, integer, or string."); + return null; + {{/jakarta}} + {{^jakarta}} throw context.mappingException("Expected type float, integer, or string."); + {{/jakarta}} } private ZoneId getZone(DeserializationContext context) { diff --git a/src/main/resources/handlebars/JavaSpring/libraries/spring-boot/pom.mustache b/src/main/resources/handlebars/JavaSpring/libraries/spring-boot/pom.mustache index 1a18ebd250..f524cc226c 100644 --- a/src/main/resources/handlebars/JavaSpring/libraries/spring-boot/pom.mustache +++ b/src/main/resources/handlebars/JavaSpring/libraries/spring-boot/pom.mustache @@ -6,9 +6,14 @@ {{artifactId}} {{artifactVersion}} + {{#jakarta}} + 17 + {{/jakarta}} + {{^jakarta}} {{#java11}}11{{/java11}}{{^java11}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/java11}} ${java.version} ${java.version} + {{/jakarta}} {{#useOas2}} 2.9.2 {{/useOas2}} @@ -19,7 +24,12 @@ org.springframework.boot spring-boot-starter-parent + {{#jakarta}} + 3.3.4 + {{/jakarta}} + {{^jakarta}} {{springBootVersion}} + {{/jakarta}} src/main/java @@ -66,7 +76,13 @@ org.springframework.boot spring-boot-starter-tomcat - + {{#jakarta}} + + org.hibernate.validator + hibernate-validator + 8.0.1.Final + + {{/jakarta}} {{#useOas2}} @@ -139,6 +155,7 @@ jakarta.validation jakarta.validation-api + 3.0.2 {{/jakarta}} {{^jakarta}} diff --git a/src/main/resources/handlebars/JavaSpring/libraries/spring-boot/swagger2SpringBoot.mustache b/src/main/resources/handlebars/JavaSpring/libraries/spring-boot/swagger2SpringBoot.mustache index 46fd67794d..a8bdebda3b 100644 --- a/src/main/resources/handlebars/JavaSpring/libraries/spring-boot/swagger2SpringBoot.mustache +++ b/src/main/resources/handlebars/JavaSpring/libraries/spring-boot/swagger2SpringBoot.mustache @@ -27,8 +27,12 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; import org.springframework.context.annotation.Configuration; import org.springframework.format.FormatterRegistry; +{{#jakarta}} +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +{{/jakarta}} +{{^jakarta}} import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - +{{/jakarta}} @SpringBootApplication {{#useOas2}} @EnableSwagger2 @@ -62,7 +66,12 @@ public class Swagger2SpringBoot implements CommandLineRunner { {{/useBeanValidation}} @Configuration + {{#jakarta}} + static class CustomDateConfig implements WebMvcConfigurer { + {{/jakarta}} + {{^jakarta}} static class CustomDateConfig extends WebMvcConfigurerAdapter { + {{/jakarta}} @Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new LocalDateConverter("{{#datePattern}}{{datePattern}}{{/datePattern}}{{^datePattern}}yyyy-MM-dd{{/datePattern}}")); diff --git a/src/main/resources/handlebars/JavaSpring/libraries/spring-boot3/pom.mustache b/src/main/resources/handlebars/JavaSpring/libraries/spring-boot3/pom.mustache index d1713dd3e7..18dc2b9479 100644 --- a/src/main/resources/handlebars/JavaSpring/libraries/spring-boot3/pom.mustache +++ b/src/main/resources/handlebars/JavaSpring/libraries/spring-boot3/pom.mustache @@ -8,14 +8,14 @@ UTF-8 17 - 3.1.1 - 2.2.14 + 3.3.4 + 2.2.25 1.7.0 org.springframework.boot spring-boot-starter-parent - 3.1.1 + 3.3.4 src/main/java @@ -44,6 +44,11 @@ spring-boot-starter-tomcat ${springboot-version} + + org.hibernate.validator + hibernate-validator + 8.0.1.Final + {{#withXml}} com.fasterxml.jackson.dataformat diff --git a/src/test/java/io/swagger/codegen/v3/generators/java/SpringGeneratorTest.java b/src/test/java/io/swagger/codegen/v3/generators/java/SpringGeneratorTest.java index 0d66ade7c0..84f91b8845 100644 --- a/src/test/java/io/swagger/codegen/v3/generators/java/SpringGeneratorTest.java +++ b/src/test/java/io/swagger/codegen/v3/generators/java/SpringGeneratorTest.java @@ -32,6 +32,8 @@ public void testGenerator() throws Exception { false)) // OpenAPI 3.x - use true for Swagger/OpenAPI 2.x definitions .options( new Options() + // .library("spring-boot3") + // .addAdditionalProperty("jakarta", true) // .addAdditionalProperty("validationMode", "loose") // .addAdditionalProperty("validationMode", "legacy") // .addAdditionalProperty("validationMode", "legacyNullable") From 09c0965be291f64058bc53d22a4d4c5c7dd48211 Mon Sep 17 00:00:00 2001 From: frantuma Date: Tue, 15 Oct 2024 12:29:57 +0200 Subject: [PATCH 02/13] update dependencies --- pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index a19f6a361e..6c98d31663 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ io.swagger.codegen.v3 swagger-codegen-generators - 1.0.52 + 1.0.53-SNAPSHOT jar @@ -256,7 +256,7 @@ org.mockito mockito-core - 5.12.0 + 5.14.1 test @@ -264,20 +264,20 @@ 8 3.0.62 2.1.22 - 2.2.22 + 2.2.25 2.17.2 2.17.2 2.11.1 3.3.0 - 2.16.1 + 2.17.0 1.9.0 4.13.2 1.0.0 - 3.16.0 + 3.17.0 2.0.9 3.2.1 7.10.2 - 3.3.0 + 3.5.1 1.49 0.10.2 From 38e0b146c579331a4af4420ae8c0ce0575a3d6bd Mon Sep 17 00:00:00 2001 From: frantuma Date: Tue, 15 Oct 2024 21:28:58 +0200 Subject: [PATCH 03/13] prepare release 1.0.53 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 6c98d31663..2409c896a6 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ io.swagger.codegen.v3 swagger-codegen-generators - 1.0.53-SNAPSHOT + 1.0.53 jar @@ -262,7 +262,7 @@ 8 - 3.0.62 + 3.0.63 2.1.22 2.2.25 2.17.2 From 0be174b16f4316e96a173bdb47e7a50d2f4c730f Mon Sep 17 00:00:00 2001 From: frantuma Date: Wed, 16 Oct 2024 14:40:15 +0200 Subject: [PATCH 04/13] bump snapshot 1.0.54-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2409c896a6..d6472412a5 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ io.swagger.codegen.v3 swagger-codegen-generators - 1.0.53 + 1.0.54-SNAPSHOT jar From 63714c64ff30bbc1fd0f20e524aa071163c2f3db Mon Sep 17 00:00:00 2001 From: frantuma Date: Thu, 17 Oct 2024 12:32:58 +0200 Subject: [PATCH 05/13] bump codegen to 3.0.64-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d6472412a5..85a4fea1ec 100644 --- a/pom.xml +++ b/pom.xml @@ -262,7 +262,7 @@ 8 - 3.0.63 + 3.0.64-SNAPSHOT 2.1.22 2.2.25 2.17.2 From 4d4fd87af7c3d6e875d64f4c3cba8632ff686dd1 Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 4 Nov 2024 13:43:00 +0100 Subject: [PATCH 06/13] refs #1319 - add configFiles list --- .../v3/generators/DefaultCodegenConfig.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java b/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java index f898c218d3..d3bc1a0153 100644 --- a/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java +++ b/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java @@ -141,10 +141,11 @@ public abstract class DefaultCodegenConfig implements CodegenConfig { protected String templateVersion; protected String embeddedTemplateDir; protected String commonTemplateDir = "_common"; - protected Map additionalProperties = new HashMap(); + protected Map additionalProperties = new HashMap<>(); protected Map vendorExtensions = new HashMap(); - protected List supportingFiles = new ArrayList(); - protected List cliOptions = new ArrayList(); + protected List supportingFiles = new ArrayList<>(); + protected List configFiles = new ArrayList<>(); + protected List cliOptions = new ArrayList<>(); protected List languageArguments; protected boolean skipOverwrite; protected boolean removeOperationIdPrefix; @@ -664,6 +665,10 @@ public List supportingFiles() { return supportingFiles; } + public List configFiles() { + return configFiles; + } + public String outputFolder() { return outputFolder; } @@ -3807,13 +3812,16 @@ protected String getOptionValue(String optionName) { return codegenArgumentOptional.get().getValue(); } + public void writeOptional(String outputFolder, SupportingFile supportingFile) { + writeOptional(outputFolder, supportingFile, false); + } /** * Only write if the file doesn't exist * * @param outputFolder Output folder * @param supportingFile Supporting file */ - public void writeOptional(String outputFolder, SupportingFile supportingFile) { + public void writeOptional(String outputFolder, SupportingFile supportingFile, boolean configFile) { String folder = ""; if(outputFolder != null && !"".equals(outputFolder)) { @@ -3826,8 +3834,9 @@ public void writeOptional(String outputFolder, SupportingFile supportingFile) { else { folder = supportingFile.destinationFilename; } + List targetFiles = configFile ? this.configFiles : this.supportingFiles; if(!new File(folder).exists()) { - supportingFiles.add(supportingFile); + targetFiles.add(supportingFile); } else { LOGGER.info("Skipped overwriting " + supportingFile.destinationFilename + " as the file already exists in " + folder); } From f10a1a007a12a855b6227520e92168338f9351ea Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 4 Nov 2024 13:50:48 +0100 Subject: [PATCH 07/13] refs #1319 - fix validation --- .../v3/generators/java/SpringCodegen.java | 9 +++++---- .../handlebars/JavaSpring/model.mustache | 4 ++-- .../v3/generators/java/SpringGeneratorTest.java | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/main/java/io/swagger/codegen/v3/generators/java/SpringCodegen.java b/src/main/java/io/swagger/codegen/v3/generators/java/SpringCodegen.java index ce31cc6c0d..f9fe4790c5 100644 --- a/src/main/java/io/swagger/codegen/v3/generators/java/SpringCodegen.java +++ b/src/main/java/io/swagger/codegen/v3/generators/java/SpringCodegen.java @@ -293,6 +293,7 @@ public void processOpts() { if (additionalProperties.containsKey(USE_BEANVALIDATION)) { this.setUseBeanValidation(convertPropertyToBoolean(USE_BEANVALIDATION)); + writePropertyBack(USE_BEANVALIDATION, this.useBeanValidation); } if (additionalProperties.containsKey(USE_OPTIONAL)) { @@ -320,10 +321,10 @@ public void processOpts() { if (useBeanValidation) { writePropertyBack(USE_BEANVALIDATION, useBeanValidation); if (VALIDATION_MODE_LOOSE.equals(validationMode) || VALIDATION_MODE_STRICT.equals(validationMode)) { - supportingFiles.add(new SupportingFile("NotUndefined.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "NotUndefined.java")); - supportingFiles.add(new SupportingFile("NotUndefinedValidator.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "NotUndefinedValidator.java")); + writeOptional(outputFolder, new SupportingFile("NotUndefined.mustache", + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "NotUndefined.java"), true); + writeOptional(outputFolder, new SupportingFile("NotUndefinedValidator.mustache", + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "NotUndefinedValidator.java"), true); } } diff --git a/src/main/resources/handlebars/JavaSpring/model.mustache b/src/main/resources/handlebars/JavaSpring/model.mustache index 16c0b0228d..8fb655915c 100644 --- a/src/main/resources/handlebars/JavaSpring/model.mustache +++ b/src/main/resources/handlebars/JavaSpring/model.mustache @@ -11,11 +11,11 @@ import java.io.Serializable; import org.springframework.validation.annotation.Validated; {{#isLooseValidation}} import org.openapitools.jackson.nullable.JsonNullable; -import io.swagger.configuration.NotUndefined; +import {{configPackage}}.NotUndefined; {{/isLooseValidation}} {{#isStrictValidation}} import org.openapitools.jackson.nullable.JsonNullable; -import io.swagger.configuration.NotUndefined; +import {{configPackage}}.NotUndefined; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; diff --git a/src/test/java/io/swagger/codegen/v3/generators/java/SpringGeneratorTest.java b/src/test/java/io/swagger/codegen/v3/generators/java/SpringGeneratorTest.java index 84f91b8845..30c03e53c8 100644 --- a/src/test/java/io/swagger/codegen/v3/generators/java/SpringGeneratorTest.java +++ b/src/test/java/io/swagger/codegen/v3/generators/java/SpringGeneratorTest.java @@ -20,6 +20,9 @@ public class SpringGeneratorTest extends AbstractCodegenTest { @Test public void testGenerator() throws Exception { + System.setProperty("supportingFiles", "false"); + System.setProperty("generateModels", "true"); + System.setProperty("generateApis", "true"); String path = getOutFolder(false).getAbsolutePath(); GenerationRequest request = new GenerationRequest(); request @@ -32,13 +35,20 @@ public void testGenerator() throws Exception { false)) // OpenAPI 3.x - use true for Swagger/OpenAPI 2.x definitions .options( new Options() - // .library("spring-boot3") - // .addAdditionalProperty("jakarta", true) + .addAdditionalProperty("dateLibrary", "legacy") + .addAdditionalProperty("serializableModel", false) + .addAdditionalProperty("useTags", true) + .addAdditionalProperty("generateForOpenFeign", true) + .addAdditionalProperty("configPackage", "test.configPackage") + // .addAdditionalProperty("generateSupportingFiles", false) + .library("spring-cloud") + .addAdditionalProperty("jakarta", true) // .addAdditionalProperty("validationMode", "loose") // .addAdditionalProperty("validationMode", "legacy") // .addAdditionalProperty("validationMode", "legacyNullable") - // .addAdditionalProperty("useBeanValidation", false) + .addAdditionalProperty("useBeanValidation", false) // .addAdditionalProperty("useNullableForNotNull", false) + .modelPackage("test.foo") .outputDir(path) ); From e0bc7ff8ec71baef5a147d1ff7c7ace8e095e736 Mon Sep 17 00:00:00 2001 From: MicRyc Date: Mon, 4 Nov 2024 11:14:19 +0100 Subject: [PATCH 08/13] refs-https://github.com/swagger-api/swagger-codegen/issues/12448 / Use ParameterMessageInterpolation to get rid of hibernate error with missing dependency --- .../handlebars/Java/libraries/okhttp-gson/api.mustache | 7 ++++++- .../handlebars/Java/libraries/okhttp4-gson/api.mustache | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/resources/handlebars/Java/libraries/okhttp-gson/api.mustache b/src/main/resources/handlebars/Java/libraries/okhttp-gson/api.mustache index ff1785a32f..c5747541b7 100644 --- a/src/main/resources/handlebars/Java/libraries/okhttp-gson/api.mustache +++ b/src/main/resources/handlebars/Java/libraries/okhttp-gson/api.mustache @@ -12,6 +12,7 @@ import {{invokerPackage}}.ProgressRequestBody; import {{invokerPackage}}.ProgressResponseBody; {{#performBeanValidation}} import {{invokerPackage}}.BeanValidationException; +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator; {{/performBeanValidation}} import com.google.gson.reflect.TypeToken; @@ -42,6 +43,7 @@ import javax.validation.executable.ExecutableValidator; import java.util.Set; import java.lang.reflect.Method; import java.lang.reflect.Type; +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator; {{/performBeanValidation}} {{#imports}}import {{import}}; @@ -165,7 +167,10 @@ public class {{classname}} { {{/performBeanValidation}} {{#performBeanValidation}} try { - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); + ValidatorFactory factory = Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory(); ExecutableValidator executableValidator = factory.getValidator().forExecutables(); Object[] parameterValues = { {{#parameters}}{{paramName}}{{#has this 'more'}}, {{/has}}{{/parameters}} }; diff --git a/src/main/resources/handlebars/Java/libraries/okhttp4-gson/api.mustache b/src/main/resources/handlebars/Java/libraries/okhttp4-gson/api.mustache index 4a13e61eea..b5100c3e82 100644 --- a/src/main/resources/handlebars/Java/libraries/okhttp4-gson/api.mustache +++ b/src/main/resources/handlebars/Java/libraries/okhttp4-gson/api.mustache @@ -29,6 +29,7 @@ import javax.validation.executable.ExecutableValidator; import java.util.Set; import java.lang.reflect.Method; import java.lang.reflect.Type; +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator; {{/performBeanValidation}} {{#imports}}import {{import}}; @@ -147,7 +148,10 @@ public class {{classname}} { {{/performBeanValidation}} {{#performBeanValidation}} try { - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); + ValidatorFactory factory = Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory(); ExecutableValidator executableValidator = factory.getValidator().forExecutables(); Object[] parameterValues = { {{#parameters}}{{paramName}}{{#has this 'more'}}, {{/has}}{{/parameters}} }; From abc25b8d61698d0eb0d55b8f63a9a4d2bf83ccd6 Mon Sep 17 00:00:00 2001 From: frantuma Date: Thu, 7 Nov 2024 13:22:03 +0100 Subject: [PATCH 09/13] prepare release 1.0.54 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 85a4fea1ec..00d78a7a44 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ io.swagger.codegen.v3 swagger-codegen-generators - 1.0.54-SNAPSHOT + 1.0.54 jar @@ -262,7 +262,7 @@ 8 - 3.0.64-SNAPSHOT + 3.0.64 2.1.22 2.2.25 2.17.2 From 057428dc11166c4bc86a7b317026f0f3d5408cc5 Mon Sep 17 00:00:00 2001 From: frantuma Date: Fri, 8 Nov 2024 09:43:01 +0100 Subject: [PATCH 10/13] bump snapshot 1.0.55-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 00d78a7a44..2b07fed064 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ io.swagger.codegen.v3 swagger-codegen-generators - 1.0.54 + 1.0.55-SNAPSHOT jar From ffce5a14838d519fd3f48704d022b9f911bbdebc Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 2 Dec 2024 12:43:27 +0100 Subject: [PATCH 11/13] html2: fix rendering of primitive props --- .../resources/handlebars/htmlDocs2/js_jsonschemaview.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/handlebars/htmlDocs2/js_jsonschemaview.mustache b/src/main/resources/handlebars/htmlDocs2/js_jsonschemaview.mustache index f263d005c2..c712924ceb 100644 --- a/src/main/resources/handlebars/htmlDocs2/js_jsonschemaview.mustache +++ b/src/main/resources/handlebars/htmlDocs2/js_jsonschemaview.mustache @@ -141,7 +141,7 @@ var JSONSchemaView = (function () { this.isPrimitive = !this.isAny && !this.isArray && !this.isObject; // - this.showToggle = this.schema.description || this.schema.title || this.isPrimitive && (this.schema.minimum || this.schema.maximum || this.schema.exclusiveMinimum || this.schema.exclusiveMaximum); + this.showToggle = this.schema.description || this.schema.title || this.isPrimitive && (this.schema.minimum || this.schema.maximum || this.schema.exclusiveMinimum || this.schema.exclusiveMaximum || this.schema.maxLength || this.schema.minLength || this.schema.pattern || this.schema.format); // populate isRequired property down to properties if (this.schema && Array.isArray(this.schema.required)) { From a9d014ac50cec41da29040cd5df6dfc296967e06 Mon Sep 17 00:00:00 2001 From: frantuma Date: Wed, 18 Dec 2024 07:22:03 +0100 Subject: [PATCH 12/13] fix Decimal processing in CSharp --- pom.xml | 2 +- .../swagger/codegen/v3/generators/DefaultCodegenConfig.java | 4 ++-- .../codegen/v3/generators/dotnet/AbstractCSharpCodegen.java | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 2b07fed064..ea792d2ceb 100644 --- a/pom.xml +++ b/pom.xml @@ -262,7 +262,7 @@ 8 - 3.0.64 + 3.0.65-SNAPSHOT 2.1.22 2.2.25 2.17.2 diff --git a/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java b/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java index d3bc1a0153..b8eaa280b2 100644 --- a/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java +++ b/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java @@ -2168,7 +2168,7 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation if (schema == null) { CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER); - codegenParameter.description = body.getDescription(); + codegenParameter.description = escapeText(body.getDescription()); codegenParameter.unescapedDescription = body.getDescription(); String bodyName = REQUEST_BODY_NAME; if (body.getExtensions() != null && body.getExtensions().get("x-codegen-request-body-name") != null) { @@ -2679,7 +2679,7 @@ public CodegenParameter fromRequestBody(RequestBody body, String name, Schema sc } codegenParameter.baseName = bodyName; codegenParameter.paramName = bodyName; - codegenParameter.description = body.getDescription(); + codegenParameter.description = escapeText(body.getDescription()); codegenParameter.unescapedDescription = body.getDescription(); codegenParameter.required = body.getRequired() != null ? body.getRequired() : Boolean.FALSE; codegenParameter.getVendorExtensions().put(CodegenConstants.IS_BODY_PARAM_EXT_NAME, Boolean.TRUE); diff --git a/src/main/java/io/swagger/codegen/v3/generators/dotnet/AbstractCSharpCodegen.java b/src/main/java/io/swagger/codegen/v3/generators/dotnet/AbstractCSharpCodegen.java index 4af6b28480..4e6e39e446 100644 --- a/src/main/java/io/swagger/codegen/v3/generators/dotnet/AbstractCSharpCodegen.java +++ b/src/main/java/io/swagger/codegen/v3/generators/dotnet/AbstractCSharpCodegen.java @@ -152,6 +152,8 @@ public AbstractCSharpCodegen() { "String", "Boolean", "Double", + "Decimal", + "BigDecimal", "Int32", "Int64", "Float", From 454249e656edc914a111d6833ef883922afd1aac Mon Sep 17 00:00:00 2001 From: frantuma Date: Wed, 18 Dec 2024 11:27:56 +0100 Subject: [PATCH 13/13] prepare release 1.0.55 --- pom.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index ea792d2ceb..78453c12d6 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ io.swagger.codegen.v3 swagger-codegen-generators - 1.0.55-SNAPSHOT + 1.0.55 jar @@ -256,17 +256,17 @@ org.mockito mockito-core - 5.14.1 + 5.14.2 test 8 - 3.0.65-SNAPSHOT - 2.1.22 - 2.2.25 - 2.17.2 - 2.17.2 + 3.0.65 + 2.1.23 + 2.2.26 + 2.18.0 + 2.18.0 2.11.1 3.3.0 2.17.0