Skip to content

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.

@jgarciadelanoceda
Copy link
Contributor

@dougclutter
I have just created a fix to #2920, the PR has just been merged and seen your PR it is just touching the same code I did with #2941. Could you review if this PR is still needed?

@dougclutter
Copy link
Author

I'm closing down this PR; I just don't have time to dive back into this. Sorry folks!

@dougclutter dougclutter deleted the add-support-for-enums-with-jsonserializercontext branch June 10, 2024 20:37
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

3 participants