Skip to content

Commit d2e3ba1

Browse files
committed
add dollar escaping for multiline strings and test
1 parent b89a2f1 commit d2e3ba1

File tree

1 file changed

+31
-38
lines changed

1 file changed

+31
-38
lines changed

modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2725,44 +2725,37 @@ public void testDollarsAndQuotesSwagger2() {
27252725
"@get:JsonProperty(\"\\$name\") val dollarName: kotlin.String? = \"SQ = \\\"; SBS = \\\\; DBS = \\\\\\\\; SD = \\$some\""
27262726
)
27272727
));
2728-
// assertGeneratedFilesNotContain(Map.of(
2729-
// apiSources.resolve("src/main/kotlin/org/openapitools/api/itemsApi.kt"),
2730-
// List.of(
2731-
// "SQ = \\\\\";",
2732-
// "SBS = \\\\\\\\;",
2733-
// "DBS = \\\\\\\\\\\\\\\\;",
2734-
// "SD = \\\\$some",
2735-
// "@PathVariable(\"item$Id\")",
2736-
// "@PathVariable(\"item$SubId\")",
2737-
// "@RequestParam(value = \"filter$Type\"",
2738-
// "@RequestParam(value = \"filter$SubType\"",
2739-
// "@CookieValue(name = \"session$Token\"",
2740-
// "@CookieValue(name = \"session$TokenTwo\"",
2741-
// "@RequestParam(value = \"form$Name\"",
2742-
// "@RequestParam(value = \"form$Value\"",
2743-
// "PATH_ITEMS_ITEM_ID_SOMETHING_ITEM_SUB_ID_GET: String = \"/items/{item$Id}/something/{item$SubId}\"",
2744-
// "/* \"/items/{item\\$Id}/something/{item\\$SubId}\" */"
2745-
// ),
2746-
// apiSources.resolve("src/main/kotlin/org/openapitools/model/ItemsItemIdSomethingItemSubIdGet200Response.kt"),
2747-
// List.of(
2748-
// "SQ = \\\\\";",
2749-
// "SBS = \\\\\\\\;",
2750-
// "DBS = \\\\\\\\\\\\\\\\;",
2751-
// "SD = \\\\$some",
2752-
// "item$Id",
2753-
// "name$Value",
2754-
// "details$Info"
2755-
// ),
2756-
// apiSources.resolve("src/main/kotlin/org/openapitools/model/ItemWithDollarAttributesAndExamples.kt"),
2757-
// List.of(
2758-
// "SQ = \\\\\";",
2759-
// "SBS = \\\\\\\\;",
2760-
// "DBS = \\\\\\\\\\\\\\\\;",
2761-
// "SD = \\\\$some",
2762-
// "\"$id\"",
2763-
// "\"$name\""
2764-
// )
2765-
// ));
2728+
assertGeneratedFilesNotContain(Map.of(
2729+
apiSources.resolve("src/main/kotlin/org/openapitools/api/itemsApi.kt"),
2730+
List.of(
2731+
"SQ = \\\\\";",
2732+
"SBS = \\\\\\\\;",
2733+
"DBS = \\\\\\\\\\\\\\\\;",
2734+
"SD = \\\\$some",
2735+
"@PathVariable(\"item$Id\") itemDollarId: kotlin.String",
2736+
"@PathVariable(\"item$SubId\") itemDollarSubId: kotlin.String",
2737+
"@RequestParam(value = \"filter$Type\", required = false, defaultValue = \"SQ = \\\"; SBS = \\\\; DBS = \\\\\\\\; SD = $some\") filterDollarType: kotlin.String",
2738+
"@RequestParam(value = \"filter$SubType\", required = false, defaultValue = \"SQ = \\\"; SBS = \\\\; DBS = \\\\\\\\; SD = $some\") filterDollarSubType: kotlin.String",
2739+
"@CookieValue(name = \"session$Token\"",
2740+
"@CookieValue(name = \"session$TokenTwo\""
2741+
),
2742+
apiSources.resolve("src/main/kotlin/org/openapitools/model/ItemsItemIdSomethingItemSubIdGet200Response.kt"),
2743+
List.of(
2744+
"SQ = \\\\\";",
2745+
"SBS = \\\\\\\\;",
2746+
"DBS = \\\\\\\\\\\\\\\\;",
2747+
"SD = \\\\$some",
2748+
"* @param itemDollarId SQ = \"; SBS = \\; DBS = \\\\; SD = \\$some",
2749+
"* @param nameDollarValue SQ = \"; SBS = \\; DBS = \\\\; SD = \\$some"
2750+
),
2751+
apiSources.resolve("src/main/kotlin/org/openapitools/model/ItemWithDollarAttributesAndExamples.kt"),
2752+
List.of(
2753+
"SQ = \\\\\";",
2754+
"SBS = \\\\\\\\;",
2755+
"DBS = \\\\\\\\\\\\\\\\;",
2756+
"SD = \\\\$some"
2757+
)
2758+
));
27662759
}
27672760

27682761
private Path generateApiSources(

0 commit comments

Comments
 (0)