[MASS-579] Fix API function signatures to use single request parameter object #252
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses a bug in the client-js library where API function signatures were generated with positional parameters (it the openapi-generator-cli default), leading to cluttered function calls, especially for endpoints with many optional parameters. This mismatched user expectations and the documented examples, forcing developers to pass explicit
undefinedvalues for skipped optional params. Positional parameters are the default for how openapi-generator-cli generate the library and this went unnoticed for a long time since the example endpoints I was using to test/verify the library did not contain enough optional parameters.Before (Buggy Behavior):
API methods accepted individual positional arguments for each parameter (e.g., path, query, header, body). For endpoints with numerous optional params, this resulted in verbose calls where developers had to list out all params in order, using
undefinedas placeholders for unused ones.Example (from MASS-579 report):
This was cumbersome and did not align with the intuitive, object-based usage shown in examples.
After (Fixed Behavior):
By adding
useSingleRequestParameter=trueto the OpenAPI generator command for the typescript-axios target, all request parameters are now bundled into a single required object (e.g.,requestParameters). This cleans up the function signatures, making them more readable and flexible. Developers can pass only the needed properties in a named object, with optional ones omitted.Updated generator command:
Example (expected and now working usage):
Impact and Release Plan:
This is a breaking change as it alters all API function signatures across the library. The developer impact is significant, requiring updates to existing codebases, but it better matches expectations and improves usability. We will release this as a major version bump to v10.x to signal the breakage.
Testing:
listTickers). I tested most of the current code examples across the website and this works as expected.This change brings the library in line with modern TypeScript practices and reduces friction for users.