8000 How to create custom refit attributes? · Issue #793 · reactiveui/refit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
How to create custom refit attributes? #793
Closed
@Josrph

Description

@Josrph

am trying to create a custom refit attribute like this:

[AttributeUsage(AttributeTargets.Method)]
public class CustomGetAttribute : GetAttribute
{
    public CustomGetAttribute(string path) : base(path) { }
}
public interface ICustomerService
{
    [CustomGet("/TestMethod")]
    Task TestMethod();
}

but a warning appears in visual studio output window when building the project:

D:\source\repos\RefitApiTest\packages\Refit.4.8.14\build\net461\refit.targets(30,5): warning : warning RF001: Method ICustomerService.TestMethod either has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument.

and the method fails to generate in RefitStubs.g.cs?

Task ICustomerService.TestMethod()
{
    throw new NotImplementedException("Either this method has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument.");
}

is it possible to create custom refit attributes?

Metadata

Metadata

Assignees

Labels

enhancementsemantic-analysisBug reports/change requests that would require semantic analysis in the stub generator

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0