cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass array of objects using query string in SwaggerUI

Highlighted
Occasional Visitor

How to pass array of objects using query string in SwaggerUI

How to pass array of objects using query string in SwaggerUI? When i use PostMan2019-04-11 16_02_41-Postman.pngwith query http://localhost:50353/contacts/filter?filters[0].PropertyName=name&filters[0].Operator=Equal&filter... it works properly but when i use SwaggerUI2019-04-11 16_09_09-Swagger UI.png it bind empty model and pass query string like this: {?Filters=filters%5B0%5D.PropertyName%3Dname%26filters%5B0%5D.Operator%3DEqual%26filters%5B0%5D.Value%3D18&Filters=}

 

    [HttpGet]
    [Route("/contacts/filter")]
    [ValidateModelState]
    [SwaggerOperation("PostContactFilter")]
    [SwaggerResponse(statusCode: 200, type: typeof(List<Contact>), description: "Successful contact request")]
    [SwaggerResponse(statusCode: 204, type: typeof(Contact), description: "No content")]
    public virtual IActionResult GetContacts([FromQuery]FiltersModel filtersModel)
    {
        var result = _logic.GetContacts(filtersModel);
        if (result is null || result.Count == 0)
            return NoContent();
        else
            return Ok(result);
    }
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors