Skip to content

Commit 3e5e40d

Browse files
committed
add open and close brace placeholders to additionalProperties for all mustache templates in all code gens
1 parent 0c31459 commit 3e5e40d

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
@@ -391,6 +391,10 @@ protected void useCodegenAsMustacheParentContext() {
391391

392392
@Override
393393
public void processOpts() {
394+
// add open brace {{openbrace}} and close brace {{closebrace}} to additionalProperties for all mustache templates
395+
// to use when needed to use them where mustache would prevent plaintext
396+
additionalProperties.put("openbrace", "{");
397+
additionalProperties.put("closebrace", "}");
394398

395399
if (!additionalProperties.containsKey(CodegenConstants.MUSTACHE_PARENT_CONTEXT)) {
396400
// by default empty parent context

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
@@ -63,9 +63,6 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
6363
"ApiResponse"
6464
));
6565

66-
public static final String OPEN_BRACE = "{";
67-
public static final String CLOSE_BRACE = "}";
68-
6966
public static final String TITLE = "title";
7067
public static final String SERVER_PORT = "serverPort";
7168
public static final String CONFIG_PACKAGE = "configPackage";
@@ -222,9 +219,6 @@ public KotlinSpringServerCodegen() {
222219
// cliOptions default redefinition need to be updated
223220
updateOption(CodegenConstants.ARTIFACT_ID, this.artifactId);
224221

225-
additionalProperties.put("openbrace", OPEN_BRACE);
226-
additionalProperties.put("closebrace", CLOSE_BRACE);
227-
228222
// Use lists instead of arrays
229223
typeMapping.put("array", "kotlin.collections.List");
230224
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
@@ -123,9 +123,6 @@ public enum RequestMappingMode {
123123
}
124124
}
125125

126-
public static final String OPEN_BRACE = "{";
127-
public static final String CLOSE_BRACE = "}";
128-
129126
@Setter protected String title = "OpenAPI Spring";
130127
@Getter @Setter
131128
protected String configPackage = "org.openapitools.configuration";
@@ -222,8 +219,6 @@ public SpringCodegen() {
222219

223220
// spring uses the jackson lib
224221
jackson = true;
225-
additionalProperties.put("openbrace", OPEN_BRACE);
226-
additionalProperties.put("closebrace", CLOSE_BRACE);
227222

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

0 commit comments

Comments
 (0)