-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
SwaggerGen - Improved handling of dictionaries with enum key #3068
SwaggerGen - Improved handling of dictionaries with enum key #3068
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test for this change please?
...Swashbuckle.AspNetCore.SwaggerGen.Test/SchemaGenerator/JsonSerializerSchemaGeneratorTests.cs
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #3068 +/- ##
=======================================
Coverage 90.53% 90.53%
=======================================
Files 76 76
Lines 3095 3096 +1
Branches 504 505 +1
=======================================
+ Hits 2802 2803 +1
Misses 293 293
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Thanks! |
Thanks for quick review :) When can I expect this to be released? |
I'm not sure yet - in the meantime you can consume changes from our MyGet feed: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/deployments/MyGet.org |
Pull Request
The issue or feature being addressed
When enum used as a key for the dictionary contains no values defined, the dictionary schema becomes an object with no properties. In such case SchemaGenerator should build schema based on dictionary key and value type rather than known key values (which are unknown in fact).
Details on the issue fix or feature implementation
SchemaGenerator was modified to use "special case where the set of key values is known" only if the collection of known dictionary keys is not empty.