diff --git a/src/libs/OpenApiGenerator.Core/Models/TypeData.cs b/src/libs/OpenApiGenerator.Core/Models/TypeData.cs index 6fb6dc7003..e8748dab8d 100644 --- a/src/libs/OpenApiGenerator.Core/Models/TypeData.cs +++ b/src/libs/OpenApiGenerator.Core/Models/TypeData.cs @@ -119,7 +119,7 @@ public static string GetCSharpType( ($"global::{settings.Namespace}.{model.ExternalClassName}", true), ("string", _) when schema.Value.Enum.Any() => - ($"global::{settings.Namespace}.{(schema.Value is { Reference: not null } ? $"{schema.Value.Reference.Id}" : (model with { Style = ModelStyle.Enumeration }).ExternalClassName)}", true), + ($"global::{settings.Namespace}.{(schema.Value is { Reference: not null } ? ModelData.FromKey(schema.Value.Reference.Id, settings).ClassName : (model with { Style = ModelStyle.Enumeration }).ExternalClassName)}", true), // ("string", _) when schema.Value.Enum.Any() && settings.JsonSerializerType != JsonSerializerType.NewtonsoftJson => // ("string", true),