Hi!
I麓d like to pass a custom Filter-object to my controller method GET(Filter filter).
I have learned that setting the annotation
[HttpGet("{filter:Filter}")]
public async IActionResult Get(Filter filter)
{...}
creates a client that expects a Filter-object correctly (instead of each filter-property).
But in server I get a System.InvalidOperationException
see:
https://stackoverflow.com/questions/51423435/asp-net-core-webapi-httpget-passing-complex-type
What am I missing here?
Swagger cannot describe complex parameters for GET (this is an ASP.NET (Core) model binder feature) and thus you'll end up with lot's of normal query parameters...
You麓re right! Your answer led me to the solution.
In my case I had to add the [FromRoute]-Attribute
to the controller method argument. Runs perfectly!
Thank you!
Most helpful comment
You麓re right! Your answer led me to the solution.
In my case I had to add the [FromRoute]-Attribute
to the controller method argument. Runs perfectly!
Thank you!