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

Add return type override setting. #286

Merged
merged 5 commits into from
Jan 11, 2024

Conversation

DJ4ddi
Copy link

@DJ4ddi DJ4ddi commented Jan 11, 2024

Adds a new configuration setting to override the default return type generation. This is useful for applying the various special types supported by Refit, e.g. HttpResponseMessage, HttpContent or IApiResponse to a single method without changing the OpenAPI document.

  • Adds a new setting ResponseTypeOverride (default is an empty dictionary).
  • Resolves the return type from this dictionary before other logic.
  • Since this may override the ReturnIApiResponse setting, a utility method RefitInterfaceGenerator.IsApiResponseType is provided. Currently, this is only used for generating the correct documentation tags, but I figured it may be needed for other purposes in the future.

I did not update any generated output. The provided example does not appear in the PetStore API, so maybe it should be changed.

Copy link

codecov bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fc71967) 97.65% compared to head (29f2775) 97.67%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #286      +/-   ##
==========================================
+ Coverage   97.65%   97.67%   +0.02%     
==========================================
  Files          62       62              
  Lines        2300     2322      +22     
==========================================
+ Hits         2246     2268      +22     
  Misses         37       37              
  Partials       17       17              
Flag Coverage Δ
unittests 97.67% <100.00%> (+0.02%) ⬆️

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.

Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@christianhelle christianhelle self-assigned this Jan 11, 2024
@christianhelle christianhelle added enhancement New feature, bug fix, or request .NET Pull requests that contain changes to .NET code labels Jan 11, 2024
Copy link
Owner

@christianhelle christianhelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work @DJ4ddi

@christianhelle
Copy link
Owner

I personally, don't have such a use case but if others who use this tool do then let's get this in

@christianhelle christianhelle merged commit 6806827 into christianhelle:main Jan 11, 2024
371 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, bug fix, or request .NET Pull requests that contain changes to .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants