Annotate TryLookupByType for nullability#3719
Conversation
- Apply review comments from #3662. - Tweak implementation.
There was a problem hiding this comment.
Pull request overview
This PR adds nullability annotations to the TryLookupByType method to improve null-safety analysis by indicating that the out parameter is guaranteed to be non-null when the method returns true. The implementation has been refactored to support this annotation pattern.
- Added
[NotNullWhen(true)]attribute to thereferenceSchemaout parameter - Refactored
TryLookupByTypeimplementation to explicitly initialize the out parameter before conditional assignment - Removed
private setfromSchemasproperty accessor
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SchemaRepository.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SchemaRepository.cs
Outdated
Show resolved
Hide resolved
Add missing space.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3719 +/- ##
==========================================
+ Coverage 94.53% 94.67% +0.13%
==========================================
Files 111 111
Lines 3861 3868 +7
Branches 778 780 +2
==========================================
+ Hits 3650 3662 +12
+ Misses 211 206 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Supersedes #3662 to resolve #3659.