From 9ce27cb59cb521b6820961e044cf7bbe66492e00 Mon Sep 17 00:00:00 2001 From: Millicent Achieng Date: Fri, 2 Feb 2024 15:21:10 +0300 Subject: [PATCH] Properly handle key-value with colletions (#252) --- ApiDoctor.Publishing/CSDL/csdlextensionmethods.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ApiDoctor.Publishing/CSDL/csdlextensionmethods.cs b/ApiDoctor.Publishing/CSDL/csdlextensionmethods.cs index 2b9242a3..9673dcef 100644 --- a/ApiDoctor.Publishing/CSDL/csdlextensionmethods.cs +++ b/ApiDoctor.Publishing/CSDL/csdlextensionmethods.cs @@ -41,6 +41,8 @@ namespace ApiDoctor.Publishing.CSDL internal static class CsdlExtensionMethods { private static readonly Regex GuidRegex = new(@"[0-9a-f\-]{32,36}", RegexOptions.Compiled | RegexOptions.IgnoreCase); + + private static readonly Regex FunctionParamsRegex = new(@",(?![^\[]*])", RegexOptions.Compiled | RegexOptions.IgnoreCase); public static string RequestUriPathOnly(this MethodDefinition method, IssueLogger issues = null) { issues ??= new IssueLogger(); @@ -121,9 +123,9 @@ public static string RequestUriPathOnly(this MethodDefinition method, IssueLogge private static string NormalizeFunctionParameters(string funcParams, IssueLogger issues) { - // foo=bar, baz ='qux',x= 9 + // foo=bar,baz='qux',x= 9,quux=['corge','grault'] var normalized = new StringBuilder(); - var allParams = funcParams.Split(','); + var allParams = FunctionParamsRegex.Split(funcParams); for (int i = 0; i < allParams.Length; i++) { var param = allParams[i].Trim();