File tree 2 files changed +2
-2
lines changed
modules/openapi-generator/src
main/java/org/openapitools/codegen/languages
test/java/org/openapitools/codegen/python
2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ public String toDefaultValue(Schema p) {
214
214
String defaultValue = String .valueOf (p .getDefault ());
215
215
if (defaultValue != null ) {
216
216
defaultValue = defaultValue .replace ("\\ " , "\\ \\ " )
217
- .replace ("'" , "\' " );
217
+ .replace ("'" , "\\ '" );
218
218
if (Pattern .compile ("\r \n |\r |\n " ).matcher (defaultValue ).find ()) {
219
219
return "'''" + defaultValue + "'''" ;
220
220
} else {
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ public void testSingleQuotes() {
139
139
StringSchema schema = new StringSchema ();
140
140
schema .setDefault ("Text containing 'single' quote" );
141
141
String defaultValue = codegen .toDefaultValue (schema );
142
- Assert .assertEquals ("'Text containing \' single\' quote'" , defaultValue );
142
+ Assert .assertEquals ("'Text containing \\ 'single\ \ ' quote'" , defaultValue );
143
143
}
144
144
145
145
@ Test (description = "test backslash default" )
You can’t perform that action at this time.
0 commit comments