refit: Complex object list in Query params object doesn't get put into query string format properly
I’ve got the following QueryParams object:
`public class GetLocationsQueryParams { public GetLocationsQueryParams() { LocationDeviceData = new List<LocationDeviceData>(); }
public BasicAddress Address { get; set; }
public int Distance { get; set; }
public DistanceType DistanceType { get; set; }
public List<LocationDeviceData> LocationDeviceData { get; set; }
public int Limit { get; set; }
}`
LocationDeviceData is as follows:
public class LocationDeviceData { public string ServiceProvider { get; set; } public string VendorDeviceId { get; set; } public string VendorRepairId { get; set; } }
When I pass this into a Get call, the query string generated is as follows:
repair/locations?Address.AddressType=None&Address.Line1=1407 Fleet St.&Address.Line2=&Address.Region=MD&Address.City=Baltimore&Address.Country=US&Address.PostalCode=21231&Distance=30&DistanceType=Miles&LocationDeviceData=LocationDeviceData&Limit=20&ProgramId=a4e24585-a63c-4597-be12-a6cfdafa15ee&FulfillmentOption=WalkInRepair
Is refit unable to parse query string objects like this into a proper query string?
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 15 (4 by maintainers)
@clairernovotny complex type can serialize to query string with dot as property separator and serialization format for collections (and collection of complex types)can be done with square bracket and index.
query string for “ListOption” model can be as like below. Page=25&Limit=0&Sort[0].Direction=asc&Sort[0].Property=entryDate&Sort[1].Direction=desc&Sort[1].Property=Age
I have a similar problem. Is this issue resolved?
Can you provide me with an example or any documentation of a custom formatter?