diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 9134b103fc32..81cc11962a02 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -7583,7 +7583,8 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S Schema schema = ModelUtils.getSchemaFromRequestBody(body); Schema original = null; // check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level - if (ModelUtils.isAllOf(schema) && schema.getAllOf().size() == 1) { + if (ModelUtils.isAllOf(schema) && schema.getAllOf().size() == 1 && + schema.getType() == null && schema.getTypes() == null) { if (schema.getAllOf().get(0) instanceof Schema) { original = schema; schema = (Schema) schema.getAllOf().get(0);