Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for enums when a JsonSerializerContext is used #2723

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dougclutter
Copy link

  1. To make it clearer what Type caused a failure during generation, modified the GetDataContractFor to catch and report more details.
  2. Changed JsonConverterFunc(object value) to JsonConverterFunc(dynamic value) so that enums don't cause generation to throw a NotSupportedException when a TypeInfoResolver is used (e.g. - JsonSerializerContext).
  3. Added unit tests that have a TypeInfoResolver to demonstrate the fix.

resolves #2722

Doug Clutter added 6 commits October 5, 2023 15:11
…about the actual Type that was causing a generation failure.
…t value. Doing this allows the use of enums when using a TypeInfoResolver (e.g. - JsonSerializerContext).
… a TypeInfoResolver is used. However, JsonConverterFunc(dynamic value) works.
…tudio 2022" so .NET 7 would be available when running tests.
Havunen added a commit to Havunen/DotSwashbuckle2 that referenced this pull request Feb 18, 2024
Havunen added a commit to Havunen/DotSwashbuckle that referenced this pull request Feb 18, 2024
@martincostello
Copy link
Collaborator

Thanks for contributing - if you'd like to continue with this pull request, please rebase against the default branch to pick up our new CI.

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.

Feature Request: Provide more details on Type hierarchy when generation fails
2 participants