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

SwaggerGen - Improved handling of dictionaries with enum key #3068

Conversation

flarestudiopl
Copy link
Contributor

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.

Copy link
Collaborator

@martincostello martincostello left a 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?

@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.53%. Comparing base (1c3b099) to head (e4f0c37).

❗ 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           
Flag Coverage Δ
Linux 90.53% <100.00%> (+<0.01%) ⬆️
Windows 90.53% <100.00%> (+<0.01%) ⬆️
macOS 90.53% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@martincostello martincostello added this to the v6.8.0 milestone Sep 12, 2024
@martincostello martincostello merged commit 09a1282 into domaindrivendev:master Sep 12, 2024
9 checks passed
@martincostello
Copy link
Collaborator

Thanks!

@flarestudiopl
Copy link
Contributor Author

Thanks for quick review :) When can I expect this to be released?

@martincostello
Copy link
Collaborator

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

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.

3 participants