-
Notifications
You must be signed in to change notification settings - Fork 265
Closed
Description
In a few places in the OpenAPI.NET codebase, the GetDisplayName
method is used to resolve a prettified display name associated with an enum value from the [Display]
attribute.
public static string GetDisplayName(this Enum enumValue) |
The use of unbounded reflection in this codepath makes it difficult to enable trimming for applications that use Microsoft.OpenApi in any capacity.
public static T GetAttributeOfType<T>(this Enum enumValue) where T : Attribute |
Given the limited set of enums used in the application, I'd recommend an alternative reflection-free approach for resolving display names associated with enums. Something like a Enum <> string cache can be used to resolve this.
Assuming folks are OK with this approach, I'd be happy to submit a PR for review.
Metadata
Metadata
Assignees
Labels
No labels