OpenAPITools/openapi-generator

Feature: [TypeScript] "CollectParameters" to accept params as option-bag

オープン

#865 opened on 2018/08/21

 (15 件のコメント) (15 件のリアクション) (0 人の担当者)Java (7,516 件のフォーク)batch import
Client: TypeScriptEnhancement: FeatureHacktoberfesthelp wanted

Repository metrics

Stars
 (26,243 個のスター)
PR merge metrics
 (PR metrics pending)

説明

Description

I would like the TypeScript code generator to support "CollectParameters" extension, which tells generated methods to accept all parameters as a single object / option-bag instead of multiple, positional arguments.

This extension is described here:
https://blog.apimatic.io/swagger-2-0-extension-for-code-generation-settings-abf602c3869d

openapi-generator version

3.2.1

OpenAPI declaration file content or url
paths:
  /favorites:
    get:
      operationId: GetFavorites
      x-operation-settings:
        CollectParameters: true
      parameters:
        - in: query
          name: account_id
          type: string
        - in: query
          name: user_id
          type: string
      responses:
        '200':
          description: '200'
          schema:
            $ref: '#/definitions/Favorites'

CollectParameters: true should generate client methods that accept an option-bag of params.

await client.getFavorites({account_id: '123', user_id: '456'});
Related issues/PRs

Rewrite of TypeScript generators

コントリビューターガイド