4

I'm working on a project where there is an endpoint that receives a list of strings in the parameter, as shown in the code below:

public class PaymentFilter
{
    public List<string> Status  {get; set; }
}

[HttpGet]
public IActionResult Get([FromQuery] PaymentFilter filter)
{
    ...
}

However, in the swagger interface the status list is not reflected, as shown in the image:

enter image description here

How do I enable entries for the status list?

1
  • Not sure if this is what you're asking but to enter values for the array in swagger click "Try it out" then "Add string item" Commented Feb 9, 2022 at 23:43

1 Answer 1

7

Click Try it out button and click Add string item then you can add parameter

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

I am using dotnet core 3.1 with Swashbuckle and when I use the same type ([FromQuery] List<string> ids) of param, I don't see it returning as a list of strings but as the comma-separated single string value. Any idea? Btw, tested this out with v6.1 and it works just fine. Not sure if its a bug with package..
Did you manage to find a solution to comma separated list problem sir?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.