diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java index f1c0dd8afdbc..7182ea67cbe7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java @@ -652,7 +652,7 @@ public static Schema unaliasSchema(Map allSchemas, Schema schema if (ref == null) { LOGGER.warn("{} is not defined", schema.get$ref()); return schema; - } else if (isStringSchema(ref) && (ref.getEnum() != null && !ref.getEnum().isEmpty())) { + } else if (ref.getEnum() != null && !ref.getEnum().isEmpty()) { // top-level enum class return schema; } else if (isArraySchema(ref) || isComposedSchema(ref)) { // array def should be created as models