fix: do not emit RF001 for methods from plain non-refit base interfaces#2072
Open
reabr wants to merge 3 commits intoreactiveui:mainfrom
Open
fix: do not emit RF001 for methods from plain non-refit base interfaces#2072reabr wants to merge 3 commits intoreactiveui:mainfrom
reabr wants to merge 3 commits intoreactiveui:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2050
Problem
When a Refit interface inherited from a plain non-Refit interface (e.g. IBaseApi
with GetBaseUri()), the source generator would incorrectly emit RF001 diagnostics
for the base interface methods and attempt to generate stubs for them.
Solution
In
Parser.cs, added a filter onderivedNonRefitMethodsto only flag methodsfrom base interfaces that themselves contain at least one Refit HTTP method attribute.
Methods from plain non-Refit interfaces are now silently ignored since they are not
HTTP endpoints.
Testing
Added a fixture
IInterfaceInheritingNonRefit.cswith a plain base interface anda Refit interface inheriting from it. The snapshot test confirms that:
GetBaseUri()GetUsers()gets a generated stub