File tree Expand file tree Collapse file tree
modules/openapi-generator/src
main/java/org/openapitools/codegen/languages
test/java/org/openapitools/codegen/python Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ public String toDefaultValue(Schema p) {
214214 String defaultValue = String .valueOf (p .getDefault ());
215215 if (defaultValue != null ) {
216216 defaultValue = defaultValue .replace ("\\ " , "\\ \\ " )
217- .replace ("'" , "\' " );
217+ .replace ("'" , "\\ '" );
218218 if (Pattern .compile ("\r \n |\r |\n " ).matcher (defaultValue ).find ()) {
219219 return "'''" + defaultValue + "'''" ;
220220 } else {
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ public void testSingleQuotes() {
139139 StringSchema schema = new StringSchema ();
140140 schema .setDefault ("Text containing 'single' quote" );
141141 String defaultValue = codegen .toDefaultValue (schema );
142- Assert .assertEquals ("'Text containing \' single\' quote'" , defaultValue );
142+ Assert .assertEquals ("'Text containing \\ 'single\ \ ' quote'" , defaultValue );
143143 }
144144
145145 @ Test (description = "test backslash default" )
You can’t perform that action at this time.
0 commit comments