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

Issue 1671: Add MemberNotNullWhen attribute for Content property in IApiResponse<T> #1672

Merged
merged 4 commits into from May 26, 2024

Conversation

sguryev
Copy link
Contributor

@sguryev sguryev commented Feb 22, 2024

Potential fix for #1671

An alternative way:
new bool IsSuccessStatusCode { get; } property in the IApiResponse<T> interface with all 3 attributes above

@HavenDV
Copy link

HavenDV commented Feb 22, 2024

This is similar to Breaking Change because IApiResponse<out T> is no longer IApiResponse and this may affect those using such a cast.

I suggest doing this via virtual, like here - https://stackoverflow.com/questions/72232151/membernotnullwhen-or-other-code-analysis-attributes-for-inherited-members

For some reason I was sure that it was possible to use virtual. Ok, then we should consider using new, but this can also cause some problems

@sguryev
Copy link
Contributor Author

sguryev commented May 24, 2024

@ChrisPulman oopsie, I'm sorry. I have forgotten to add IApiResponse interface to the ApiResponse<T> class.

Added here: https://github.com/reactiveui/refit/pull/1672/files#diff-092434a9c47d4491a15166652006ca2e0263b01b63c2029aa8653e165bfa543bR32

All tests are green now locally
image

Update APIResponse as MemberNotNullWhen needs to be in same interface as members
Copy link

codecov bot commented May 26, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 87.68%. Comparing base (6ebeda5) to head (e27b0a6).
Report is 23 commits behind head on main.

Files Patch % Lines
Refit/ApiResponse.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1672      +/-   ##
==========================================
- Coverage   87.73%   87.68%   -0.05%     
==========================================
  Files          33       33              
  Lines        2348     2323      -25     
  Branches      294      289       -5     
==========================================
- Hits         2060     2037      -23     
  Misses        208      208              
+ Partials       80       78       -2     

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

@ChrisPulman ChrisPulman merged commit c0499cf into reactiveui:main May 26, 2024
1 of 3 checks passed
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.

None yet

3 participants