Skip to content

fix: do not emit RF001 for methods from plain non-refit base interfaces#2072

Open
reabr wants to merge 3 commits intoreactiveui:mainfrom
reabr:fix/inherit-non-refit-interface
Open

fix: do not emit RF001 for methods from plain non-refit base interfaces#2072
reabr wants to merge 3 commits intoreactiveui:mainfrom
reabr:fix/inherit-non-refit-interface

Conversation

@reabr
Copy link
Copy Markdown

@reabr reabr commented Mar 30, 2026

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 on derivedNonRefitMethods to only flag methods
from 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.cs with a plain base interface and
a Refit interface inheriting from it. The snapshot test confirms that:

  • No RF001 diagnostic is emitted for GetBaseUri()
  • Only the Refit method GetUsers() gets a generated stub

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.

[Bug]: Unable inherit normally from regular interface

1 participant