You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(websockets): support array parameters in Listen v1 and v2 clients (#650)
* fix(websockets): support array parameters in Listen v1 and v2 clients
Update WebSocket clients to properly handle parameters that accept both
single strings and arrays of strings. Arrays are now correctly expanded
into multiple query parameters (e.g., keyterm=term1&keyterm=term2) instead
of being URL-encoded as a single stringified array.
Fixed parameters in Listen V2:
- keyterm: now accepts string | string[]
- tag: now accepts string | string[]
Fixed parameters in Listen V1:
- keyterm: now accepts string | string[]
- keywords: now accepts string | string[]
- extra: now accepts string | string[]
- redact: now accepts string | string[]
- replace: now accepts string | string[]
- search: now accepts string | string[]
- tag: now accepts string | string[]
Changes:
- Updated client method signatures to accept Union[str, Sequence[str]]
- Added runtime type checking to detect and iterate over arrays
- Updated type definitions to reflect proper union types
- Added documentation for array parameter support
This fix ensures consistency with the AsyncAPI/OpenAPI specs and matches
the behavior of the REST API clients.
Fixes#648Fixes#629
Related to #616
* fix(types): correct ListenV1Redact type definition
- Wrap Union in Optional to match function signature
- Add str as standalone option in Union to allow any string value
- Maintains Literal types for common values (autocomplete support)
Addresses Copilot AI review comments
* test: update ListenV1Tag type assertion test
Update test to reflect new type definition:
- Changed from Optional[Any] to Optional[Union[str, Sequence[str]]]
- Updated test name and docstring for clarity
- Usage tests remain unchanged and already cover the correct behavior
Keyterm prompting can improve recognition of specialized terminology. Pass a single string or a list of strings.
71
72
72
73
mip_opt_out : typing.Optional[str]
73
74
74
-
tag : typing.Optional[str]
75
+
tag : typing.Optional[typing.Union[str, typing.Sequence[str]]]
76
+
Label your requests for the purpose of identification during usage reporting. Pass a single string or a list of strings.
75
77
76
78
authorization : typing.Optional[str]
77
79
Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter.
Keyterm prompting can improve recognition of specialized terminology. Pass a single string or a list of strings.
182
193
183
194
mip_opt_out : typing.Optional[str]
184
195
185
-
tag : typing.Optional[str]
196
+
tag : typing.Optional[typing.Union[str, typing.Sequence[str]]]
197
+
Label your requests for the purpose of identification during usage reporting. Pass a single string or a list of strings.
186
198
187
199
authorization : typing.Optional[str]
188
200
Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter.
0 commit comments