You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that BuildQueryMap uses reflection for each object passed to it. In our case it is building a query map for the type MyDerived.
This comparison compares the current property MyDerived.MyPath to any values in ParameterProperties.
The relevant value has a ParameterInfo for MyBase.MyPath, the comparison fails because they are different properties.
Refit adds MyDerived.MyPath to the query.
Note that AddObjectParametersToUrl doesn't have this issues because it uses the ParameterInfo for MyBase.MyPath to get the value from parameter, so will succesfully add the value to the path. (This might causes bugs as its using the base types property) var propertyObject = propertyInfo.PropertyInfo.GetValue(param)
I don't think this is intended behaviour, but I imagine its been in the Refit for so long that fixing it would be a breaking change.
Screenshots 🖼️
No response
IDE
No response
Operating system
No response
Version
No response
Device
No response
Refit Version
No response
Additional information ℹ️
No response
The text was updated successfully, but these errors were encountered:
Describe the bug 🐞
Passing a more derived type to a Refit method will cause properties to be used in both the path and query.
Step to reproduce
Reproduction repository
https://github.com/reactiveui/refit
Expected behavior
Refit should not add a property as a query parameter if it is already mapped to the path.
Cause:
RestMethodInfoInternal
usingMethodInfo
BuildParameterMap
identifies that the url is parameterised and that the corresponding property belongs to a parameters property.request.MyPath
, is added to theParameterProperties
list, adding theParameterInfo
forMyBase.MyPath
.RequestBuilderImplementation
uses this list inBuildQueryMap
to ensure that it doesn't add properties already used in the path to the query.BuildQueryMap
uses reflection for each object passed to it. In our case it is building a query map for the typeMyDerived
.MyDerived.MyPath
to any values inParameterProperties
.ParameterInfo
forMyBase.MyPath
, the comparison fails because they are different properties.MyDerived.MyPath
to the query.AddObjectParametersToUrl
doesn't have this issues because it uses theParameterInfo
forMyBase.MyPath
to get the value from parameter, so will succesfully add the value to the path. (This might causes bugs as its using the base types property)var propertyObject = propertyInfo.PropertyInfo.GetValue(param)
I don't think this is intended behaviour, but I imagine its been in the Refit for so long that fixing it would be a breaking change.
Screenshots 🖼️
No response
IDE
No response
Operating system
No response
Version
No response
Device
No response
Refit Version
No response
Additional information ℹ️
No response
The text was updated successfully, but these errors were encountered: