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]: generic parameters are not used for route creation #1743

Open
TimothyMakkison opened this issue Jun 28, 2024 · 0 comments
Open

[Bug]: generic parameters are not used for route creation #1743

TimothyMakkison opened this issue Jun 28, 2024 · 0 comments
Labels

Comments

@TimothyMakkison
Copy link
Contributor

TimothyMakkison commented Jun 28, 2024

Describe the bug 🐞

Refit will search through an objects properties and add them as queries, even if the the parameter is generic. I notied that it doesn't do this for generic parameters, I don't know if this is an oversight or a deliberate choice.

Step to reproduce

[Get("/foos/{request.someProperty}/bar/{request.someProperty2}")]
Task GetFooBars(PathBoundObject request);

// http://foo/foos/1/bar/barNone
fixture.GetFooBars(new PathBoundObject() { SomeProperty = 1, SomeProperty2 = "barNone" });

// generic version
[Get("/foos/{request.someProperty}/bar/{request.someProperty2}")]
Task GetFooBars<T>(T request);

// error trying to find a matching route parameter
fixture.GetFooBars(new PathBoundObject() { SomeProperty = 1, SomeProperty2 = "barNone" });

Reproduction repository

https://github.com/reactiveui/refit

Expected behavior

Matching properties in the generic object to would be used to create the route. I'm not sure if people would have a use case for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant