Skip to content

js_client: add optional request options parameter - #387

Merged
AndreyVMarkelov merged 2 commits into
mainfrom
js_gen/add_request_options
Aug 3, 2026
Merged

js_client: add optional request options parameter#387
AndreyVMarkelov merged 2 commits into
mainfrom
js_gen/add_request_options

Conversation

@AndreyVMarkelov

Copy link
Copy Markdown
Contributor

Summary

This change adds an opt-in --request-options flag to the JavaScript client backend.

When enabled, generated client methods:

  • accept an optional options parameter;
  • document it in JSDoc;
  • forward it as the final argument to this.request(...).

For example:

routes.filesUpload = function (arg, options) {
  return this.request(
    'files/upload',
    arg,
    'user',
    'content',
    'upload',
    'files.content.write',
    options
  );
};

The generated output is unchanged unless --request-options is explicitly enabled.

Motivation

Some SDKs need per-request transport options that are separate from API request arguments, such as request cancellation (AbortSignal), request timeouts, or future transport-specific behavior.

This change provides a generic mechanism for JavaScript client generators to expose those options without changing generated API request types.

@AndreyVMarkelov
AndreyVMarkelov merged commit 947f3ca into main Aug 3, 2026
13 checks passed
@AndreyVMarkelov
AndreyVMarkelov deleted the js_gen/add_request_options branch August 3, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants