From f345df9c94f53590a151d9f93f7b32b0eb1ab8c3 Mon Sep 17 00:00:00 2001 From: AW Date: Sat, 30 May 2026 15:13:15 +0000 Subject: [PATCH] fix(deserializer): handle array value from uri-template-lite in simple style path params When uri-template-lite parses a comma-separated path param (e.g. /codes/123,456 against /codes/{codeIds}), it returns a string[] rather than a string. deserializeArray assumed a string and crashed with "value.split is not a function". Guard against the already-parsed array so both shapes are handled correctly. --- packages/http/src/validator/deserializers/style/simple.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/http/src/validator/deserializers/style/simple.ts b/packages/http/src/validator/deserializers/style/simple.ts index dfa187d5e..1e02f9dba 100644 --- a/packages/http/src/validator/deserializers/style/simple.ts +++ b/packages/http/src/validator/deserializers/style/simple.ts @@ -11,7 +11,7 @@ export function deserializeSimpleStyle( const value = parameters[name]; if (type === 'array') { - return deserializeArray(value); + return deserializeArray(value as string | string[]); } else if (type === 'object') { return explode ? deserializeImplodeObject(value) : deserializeObject(value); } else { @@ -19,7 +19,8 @@ export function deserializeSimpleStyle( } } -function deserializeArray(value: string) { +function deserializeArray(value: string | string[]) { + if (Array.isArray(value)) return value; return value === '' ? [] : value.split(','); }