diff --git a/modules/openapi-generator-cli/src/main/resources/logback.xml b/modules/openapi-generator-cli/src/main/resources/logback.xml
index efa74345a0fe..0577ae5e15d2 100644
--- a/modules/openapi-generator-cli/src/main/resources/logback.xml
+++ b/modules/openapi-generator-cli/src/main/resources/logback.xml
@@ -53,16 +53,6 @@
ERROR
-
- System.err
- true
-
- ONCE
-
-
- [%thread] %highlight(%-5level) %logger{36} - %red(%msg)%n
-
-
diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml
index 7aa031395532..171ddf9f4778 100644
--- a/modules/openapi-generator/pom.xml
+++ b/modules/openapi-generator/pom.xml
@@ -385,11 +385,22 @@
${kotlin-version}
test
+
+ com.google.guava
+ guava-testlib
+ 28.2-jre
+ test
+
net.java.dev.jna
jna
5.5.0
+
+ com.github.ben-manes.caffeine
+ caffeine
+ 2.8.1
+
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractApexCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractApexCodegen.java
index e8a1aca42d5d..bb2a21d4afa9 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractApexCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractApexCodegen.java
@@ -32,6 +32,7 @@
import java.util.*;
+import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.camelize;
public abstract class AbstractApexCodegen extends DefaultCodegen implements CodegenConfig {
@@ -455,9 +456,16 @@ public CodegenModel fromModel(String name, Schema model) {
}
}
- cm.vendorExtensions.put("hasPropertyMappings", !propertyMappings.isEmpty());
- cm.vendorExtensions.put("hasDefaultValues", hasDefaultValues);
- cm.vendorExtensions.put("propertyMappings", propertyMappings);
+ // TODO: 5.0: Remove this block and ensure templates use the newer property naming.
+ once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix.");
+ cm.vendorExtensions.put("hasPropertyMappings", !propertyMappings.isEmpty()); // TODO: 5.0 Remove
+ cm.vendorExtensions.put("hasDefaultValues", hasDefaultValues); // TODO: 5.0 Remove
+ cm.vendorExtensions.put("propertyMappings", propertyMappings); // TODO: 5.0 Remove
+
+
+ cm.vendorExtensions.put("x-has-property-mappings", !propertyMappings.isEmpty());
+ cm.vendorExtensions.put("x-has-default-values", hasDefaultValues);
+ cm.vendorExtensions.put("x-property-mappings", propertyMappings);
if (!propertyMappings.isEmpty()) {
cm.interfaces.add("OAS.MappedProperties");
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java
index 7e6c09e4aebf..2a0b97066b49 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java
@@ -34,6 +34,7 @@
import java.io.File;
import java.util.*;
+import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.camelize;
public abstract class AbstractCSharpCodegen extends DefaultCodegen implements CodegenConfig {
@@ -562,12 +563,15 @@ public void updateCodegenPropertyEnum(CodegenProperty var) {
* @param models list of all models
*/
protected void updateValueTypeProperty(Map models) {
+ // TODO: 5.0: Remove the camelCased vendorExtension within the below loop and ensure templates use the newer property naming.
+ once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix.");
for (Map.Entry entry : models.entrySet()) {
String openAPIName = entry.getKey();
CodegenModel model = ModelUtils.getModelByName(openAPIName, models);
if (model != null) {
for (CodegenProperty var : model.vars) {
- var.vendorExtensions.put("isValueType", isValueType(var));
+ var.vendorExtensions.put("isValueType", isValueType(var)); // TODO: 5.0 Remove
+ var.vendorExtensions.put("x-is-value-type", isValueType(var));
}
}
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java
index b19a6a2404a9..6d8f5e97632b 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java
@@ -31,6 +31,7 @@
import java.util.*;
import static com.google.common.base.Strings.isNullOrEmpty;
+import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore;
@@ -234,16 +235,20 @@ public void postProcessParameter(CodegenParameter parameter) {
char firstChar = parameter.paramName.charAt(0);
+ // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming.
+ once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix.");
+
if (Character.isUpperCase(firstChar)) {
// First char is already uppercase, just use paramName.
- parameter.vendorExtensions.put("x-exportParamName", parameter.paramName);
-
+ parameter.vendorExtensions.put("x-exportParamName", parameter.paramName); // TODO: 5.0 Remove
+ parameter.vendorExtensions.put("x-export-param-name", parameter.paramName);
}
// It's a lowercase first char, let's convert it to uppercase
StringBuilder sb = new StringBuilder(parameter.paramName);
sb.setCharAt(0, Character.toUpperCase(firstChar));
- parameter.vendorExtensions.put("x-exportParamName", sb.toString());
+ parameter.vendorExtensions.put("x-exportParamName", sb.toString()); // TODO: 5.0 Remove
+ parameter.vendorExtensions.put("x-export-param-name", sb.toString());
}
@Override
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java
index 24547880a797..5fae7e3a01ca 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java
@@ -29,6 +29,7 @@
import java.io.File;
import java.util.*;
+import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore;
@@ -388,6 +389,10 @@ public Map postProcessOperationsWithModels(Map o
Map objectMap = (Map) objs.get("operations");
@SuppressWarnings("unchecked")
List operations = (List) objectMap.get("operation");
+
+ // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming.
+ once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix.");
+
for (CodegenOperation operation : operations) {
// http method verb conversion (e.g. PUT => Put)
operation.httpMethod = camelize(operation.httpMethod.toLowerCase(Locale.ROOT));
@@ -450,13 +455,16 @@ public Map postProcessOperationsWithModels(Map o
imports.add(createMapping("import", "github.com/antihax/optional"));
addedOptionalImport = true;
}
+
// We need to specially map Time type to the optionals package
if ("time.Time".equals(param.dataType)) {
- param.vendorExtensions.put("x-optionalDataType", "Time");
+ param.vendorExtensions.put("x-optionalDataType", "Time"); // TODO: 5.0 Remove
+ param.vendorExtensions.put("x-optional-data-type", "Time");
} else {
// Map optional type to dataType
- param.vendorExtensions.put("x-optionalDataType",
- param.dataType.substring(0, 1).toUpperCase(Locale.ROOT) + param.dataType.substring(1));
+ String optionalType = param.dataType.substring(0, 1).toUpperCase(Locale.ROOT) + param.dataType.substring(1);
+ param.vendorExtensions.put("x-optionalDataType", optionalType); // TODO: 5.0 Remove
+ param.vendorExtensions.put("x-optional-data-type", optionalType);
}
}
@@ -464,12 +472,14 @@ public Map postProcessOperationsWithModels(Map o
char nameFirstChar = param.paramName.charAt(0);
if (Character.isUpperCase(nameFirstChar)) {
// First char is already uppercase, just use paramName.
- param.vendorExtensions.put("x-exportParamName", param.paramName);
+ param.vendorExtensions.put("x-exportParamName", param.paramName); // TODO: 5.0 Remove
+ param.vendorExtensions.put("x-export-param-name", param.paramName);
} else {
// It's a lowercase first char, let's convert it to uppercase
StringBuilder sb = new StringBuilder(param.paramName);
sb.setCharAt(0, Character.toUpperCase(nameFirstChar));
- param.vendorExtensions.put("x-exportParamName", sb.toString());
+ param.vendorExtensions.put("x-exportParamName", sb.toString()); // TODO: 5.0 Remove
+ param.vendorExtensions.put("x-x-export-param-name", sb.toString());
}
}
@@ -502,16 +512,22 @@ public Map postProcessOperationsWithModels(Map o
}
private void setExportParameterName(List codegenParameters) {
+
+ // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming.
+ once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix.");
+
for (CodegenParameter param : codegenParameters) {
char nameFirstChar = param.paramName.charAt(0);
if (Character.isUpperCase(nameFirstChar)) {
// First char is already uppercase, just use paramName.
- param.vendorExtensions.put("x-exportParamName", param.paramName);
+ param.vendorExtensions.put("x-exportParamName", param.paramName); // TODO: 5.0 Remove
+ param.vendorExtensions.put("x-export-param-name", param.paramName);
} else {
// It's a lowercase first char, let's convert it to uppercase
StringBuilder sb = new StringBuilder(param.paramName);
sb.setCharAt(0, Character.toUpperCase(nameFirstChar));
- param.vendorExtensions.put("x-exportParamName", sb.toString());
+ param.vendorExtensions.put("x-exportParamName", sb.toString()); // TODO: 5.0 Remove
+ param.vendorExtensions.put("x-export-param-name", sb.toString());
}
}
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java
index af6e1cde6ccf..c79d747db80d 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java
@@ -39,6 +39,7 @@
import java.util.*;
import java.util.regex.Pattern;
+import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.*;
public abstract class AbstractJavaCodegen extends DefaultCodegen implements CodegenConfig {
@@ -998,8 +999,13 @@ public CodegenModel fromModel(String name, Schema model) {
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
if (serializeBigDecimalAsString) {
if (property.baseType.equals("BigDecimal")) {
+
+ // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming.
+ once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix.");
+
// we serialize BigDecimal as `string` to avoid precision loss
- property.vendorExtensions.put("extraAnnotation", "@JsonSerialize(using = ToStringSerializer.class)");
+ property.vendorExtensions.put("extraAnnotation", "@JsonSerialize(using = ToStringSerializer.class)"); // TODO: 5.0 Remove
+ property.vendorExtensions.put("x-extra-annotation", "@JsonSerialize(using = ToStringSerializer.class)");
// this requires some more imports to be added for this model...
model.imports.add("ToStringSerializer");
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java
index aeb076b85063..7b48fba9eaa8 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java
@@ -31,6 +31,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore;
@@ -668,10 +669,15 @@ public Map postProcessModels(Map objs) {
public Map postProcessOperationsWithModels(Map objs, List