-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Annotate TryLookupByType for nullability #3719
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
Conversation
- Apply review comments from #3662. - Tweak implementation.
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.
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.