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 @@ -387,10 +387,29 @@ public void updateCodegenPropertyEnum(CodegenProperty var) {
387387 }
388388 }
389389
390+ /**
391+ * Determines if at least one of the allOf pieces of a schema are of type string
392+ *
393+ * @param p
394+ * @return
395+ */
396+ private boolean isAllOfStringSchema (Schema schema ) {
397+ if (schema .getAllOf () != null ) {
398+ Iterator <Schema > it = schema .getAllOf ().iterator ();
399+ while (it .hasNext ()) {
400+ Schema childSchema = ModelUtils .getReferencedSchema (this .openAPI , it .next ());
401+ if (ModelUtils .isStringSchema (childSchema )) {
402+ return true ;
403+ }
404+ }
405+ }
406+ return false ;
407+ }
408+
390409 @ Override
391410 public String toDefaultValue (Schema p ) {
392411 p = ModelUtils .getReferencedSchema (this .openAPI , p );
393- if (ModelUtils .isStringSchema (p )) {
412+ if (ModelUtils .isStringSchema (p ) || isAllOfStringSchema ( p ) ) {
394413 Object defaultObj = p .getDefault ();
395414 if (defaultObj != null ) {
396415 if (defaultObj instanceof java .lang .String ) {
You can’t perform that action at this time.
0 commit comments