Skip to content

Commit 85aee00

Browse files
authored
[ALL-GENS] Utility - add open and close brace placeholders to additionalProperties for all mustache templates in all code gens (#23259)
* add open and close brace placeholders to additionalProperties for all mustache templates in all code gens * populate the map via the default constructor
1 parent e866657 commit 85aee00

4 files changed

Lines changed: 4 additions & 15 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,10 @@ public DefaultCodegen() {
18701870

18711871
// Register common Mustache lambdas.
18721872
registerMustacheLambdas();
1873+
1874+
// Initialize mustache braces placeholders for all generators
1875+
additionalProperties.putIfAbsent("openbrace", "{");
1876+
additionalProperties.putIfAbsent("closebrace", "}");
18731877
}
18741878

18751879
/**

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautAbstractCodegen.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,6 @@ public JavaMicronautAbstractCodegen() {
133133
))
134134
);
135135

136-
// Set additional properties
137-
additionalProperties.put("openbrace", "{");
138-
additionalProperties.put("closebrace", "}");
139-
140136
// Set client options that will be presented to user
141137
updateOption(INVOKER_PACKAGE, this.getInvokerPackage());
142138
updateOption(CodegenConstants.ARTIFACT_ID, this.getArtifactId());

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
6666
"ApiResponse"
6767
));
6868

69-
public static final String OPEN_BRACE = "{";
70-
public static final String CLOSE_BRACE = "}";
71-
7269
public static final String TITLE = "title";
7370
public static final String SERVER_PORT = "serverPort";
7471
public static final String CONFIG_PACKAGE = "configPackage";
@@ -245,9 +242,6 @@ public KotlinSpringServerCodegen() {
245242
// cliOptions default redefinition need to be updated
246243
updateOption(CodegenConstants.ARTIFACT_ID, this.artifactId);
247244

248-
additionalProperties.put("openbrace", OPEN_BRACE);
249-
additionalProperties.put("closebrace", CLOSE_BRACE);
250-
251245
// Use lists instead of arrays
252246
typeMapping.put("array", "kotlin.collections.List");
253247
typeMapping.put("list", "kotlin.collections.List");

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,6 @@ public enum RequestMappingMode {
129129
}
130130
}
131131

132-
public static final String OPEN_BRACE = "{";
133-
public static final String CLOSE_BRACE = "}";
134-
135132
@Setter protected String title = "OpenAPI Spring";
136133
@Getter @Setter
137134
protected String configPackage = "org.openapitools.configuration";
@@ -244,8 +241,6 @@ public SpringCodegen() {
244241

245242
// spring uses the jackson lib
246243
jackson = true;
247-
additionalProperties.put("openbrace", OPEN_BRACE);
248-
additionalProperties.put("closebrace", CLOSE_BRACE);
249244

250245
cliOptions.add(new CliOption(TITLE, "server title name or client service name").defaultValue(title));
251246
cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code")

0 commit comments

Comments
 (0)