File tree Expand file tree Collapse file tree
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -446,10 +446,28 @@ public String toDefaultValue(Schema p) {
446446 Object defaultValues = p .getDefault ();
447447 if (defaultValues instanceof ArrayNode ) {
448448 for (var value : (ArrayNode ) defaultValues ) {
449- joinedDefaultValues .add (value .toString ());
449+ if (value .isNull ()) {
450+ joinedDefaultValues .add ("nil" );
451+ } else if (value .isTextual ()) {
452+ joinedDefaultValues .add ("\" " + escapeText (value .asText ()) + "\" " );
453+ } else {
454+ joinedDefaultValues .add (value .toString ());
455+ }
456+ }
457+ return "{" + joinedDefaultValues + "}" ;
458+ } else if (defaultValues instanceof List <?>) {
459+ for (var value : (List <?>) defaultValues ) {
460+ if (value == null ) {
461+ joinedDefaultValues .add ("nil" );
462+ } else if (value instanceof String ) {
463+ joinedDefaultValues .add ("\" " + escapeText ((String ) value ) + "\" " );
464+ } else {
465+ joinedDefaultValues .add (value .toString ());
466+ }
450467 }
451468 return "{" + joinedDefaultValues + "}" ;
452469 }
470+ return null ;
453471 }
454472
455473 return super .toDefaultValue (p );
You can’t perform that action at this time.
0 commit comments