Configure non-nullable types as required#2803
Configure non-nullable types as required#2803martincostello merged 16 commits intodomaindrivendev:masterfrom
Conversation
Without this change the setting will not be set when getting SchemaGeneratorOptions from DI in SchemaGenerator
Because of the higher precedence of the && operator compared to the ?? operator we need to prioritize ?? manually with brackets.
|
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #2803 +/- ##
==========================================
- Coverage 90.67% 90.64% -0.03%
==========================================
Files 74 74
Lines 2948 2961 +13
Branches 468 469 +1
==========================================
+ Hits 2673 2684 +11
- Misses 275 277 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
src/Swashbuckle.AspNetCore.SwaggerGen/DependencyInjection/SwaggerGenOptionsExtensions.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.SwaggerGen/SchemaGenerator/SchemaGenerator.cs
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.SwaggerGen/SchemaGenerator/SchemaGenerator.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.SwaggerGen/SchemaGenerator/SchemaGeneratorOptions.cs
Outdated
Show resolved
Hide resolved
...Swashbuckle.AspNetCore.SwaggerGen.Test/SchemaGenerator/JsonSerializerSchemaGeneratorTests.cs
Outdated
Show resolved
Hide resolved
The change is located in SchemaGenerator.CreateObjectSchema.
The new comment true to what is actually done when setting this option.
src/Swashbuckle.AspNetCore.SwaggerGen/SchemaGenerator/SchemaGenerator.cs
Outdated
Show resolved
Hide resolved
|
It seems like #2810 implemented the feature in the meantime. Thanks for the feedback on the code tough. |
|
That's a slightly different use case - that's about the |
|
@martincostello This could indeed be very useful. @AntiGuideAkquinet If this could be reopened, it would be appreciated. If you don't have time to address potential comments, I would be happy to help out. :) |
|
@SimonRask I reopened the PR. Thank you for your help! |
|
Thanks for re-opening. If you resolve the merge conflicts I'll take a look. |
|
I have (hopefully correctly) resolved the conflicts in my fork. I don't know if it is easier for me to open a new pull request, or if you can pull the changes into your branch. @AntiGuideAkquinet |
|
@SimonRask Sure! I invited you as a collaborator on the forked repo that the PR is based on. You should be able to pull your changes in. 🙂 |
|
@martincostello Conflicts should be resolved now :) |
This is a contiuation of the work done in PR #2710. It closes #2036. If any changes are necessary I'll gladly add them.