The URL GetDashboardChart?stateAbbr=&varNames=VAR1&varNames=VAR2 should result in a valid query to this method. However, there is no support for this in Action.Url. I have written a custom function to handle this case:
public static string GetArrayQueryParams(IMethod method)
{
var arrayParameters = new List<string>();
foreach (var parameter in method.Parameters)
{
if (parameter.Type.IsCollection && !parameter.HasAttribute("FromBody"))
{
arrayParameters.Add($"${{{parameter.Name}.map(item => `{parameter.Name}=${{item}}`).join('&')}}");
}
}
return arrayParameters.Any() ? $"&{string.Join("&", arrayParameters)}" : string.Empty;
}
I have an API method with the following signature:
The URL
GetDashboardChart?stateAbbr=&varNames=VAR1&varNames=VAR2
should result in a valid query to this method. However, there is no support for this inAction.Url
. I have written a custom function to handle this case:Which results in the following TypeScript:
This works, but it would be better if this were built-in functionality.