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

[BUG] Interface inheritance only works in same project #650

Open
BenjaminAbt opened this Issue Apr 14, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@BenjaminAbt
Copy link

BenjaminAbt commented Apr 14, 2019

Describe the bug

The goal is to use interface inheritance from refit interfaces.
https://github.com/reactiveui/refit#interface-inheritance

This only works if all interfaces are in one project.
However, the following error occurs if the interfaces are not in the same project:

'AutoGeneratedITestRestClient' does not implement interface member 'IBaseRestClient.GetVersion()' Base.UnitTests

Project Base

public interface IBaseRestClient
{
    HttpClient Client { get; }

    [Get("/version")]
    Task<string> GetVersion();
}

Project Base.UnitTests

public interface ITestRestClient : IBaseRestClient
{
    [Get("/test")]
    Task<string> Test();
}

Generate Stubs:
GetVersion is missing here, but will be generated if in the same project.

/// <inheritdoc />
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.DebuggerNonUserCode]
[Preserve]
[global::System.Reflection.Obfuscation(Exclude=true)]
partial class AutoGeneratedITestRestClient : ITestRestClient
{
    /// <inheritdoc />
    public HttpClient Client { get; protected set; }
    readonly IRequestBuilder requestBuilder;

    /// <inheritdoc />
    public AutoGeneratedITestRestClient(HttpClient client, IRequestBuilder requestBuilder)
    {
        Client = client;
        this.requestBuilder = requestBuilder;
    }

    /// <inheritdoc />
    Task<string> ITestRestClient.Test()
    {
        var arguments = new object[] {  };
        var func = requestBuilder.BuildRestResultFuncForMethod("Test", new Type[] {  });
        return (Task<string>)func(Client, arguments);
    }
}

Expected behavior
Stub should have all methods, even if inherited interfaces are located in different projects.

Sample Project
https://github.com/BenjaminAbt/RefitInheritance

@BenjaminAbt BenjaminAbt added the bug label Apr 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.