Skip to content

Added nullable enums support#41

Open
m0a0k0s wants to merge 1 commit intounchase:masterfrom
m0a0k0s:feature/nullable-enums
Open

Added nullable enums support#41
m0a0k0s wants to merge 1 commit intounchase:masterfrom
m0a0k0s:feature/nullable-enums

Conversation

@m0a0k0s
Copy link
Copy Markdown

@m0a0k0s m0a0k0s commented Jun 4, 2025

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for nullable enum types in the Swashbuckle AspNetCore extensions by detecting and extracting the underlying enum type from nullable wrappers before processing.

Key Changes:

  • Nullable enum type handling in schema and parameter filters using Nullable.GetUnderlyingType()
  • Consistent use of the underlying enum type for generating enum names and descriptions
  • Filtering of OpenApiNull elements when processing enum documentation to maintain alignment with extension arrays

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
XEnumNamesSchemaFilter.cs Extracts underlying type from nullable enums and uses it consistently for enum name and description generation
XEnumNamesParameterFilter.cs Adds nullable enum type detection for parameter filtering
EnumTypeExtensions.cs Filters out null elements from schema.Enum collection to ensure proper alignment with extension arrays that contain only actual enum values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants