Skip to content

Tuple with multiple data types not converted #1890

@nicholaschiang

Description

@nicholaschiang

Describe the bug
When a response model is a tuple with two different data types (e.g. [Task, StarSchemaDataSource]), the generated code has an Array<any> instead of [Task, StarSchemaDataSource].

The OpenAPI spec:

        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": [
                    { "$ref": "#/components/schemas/Task" },
                    { "$ref": "#/components/schemas/StarSchemaDataSource" }
                  ],
                  "type": "array",
                  "maxItems": 2,
                  "minItems": 2,
                  "title": "Response Cold Start From Tables Api V1 Accounts  Account Name  Star Schema Data Source Cold Start From Tables Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        },

The generated code:

  /**
   * Cold Start From Tables
   * Cold start from table.
   *
   * The fully_qualified_table_name is expected to be in the format:
   * <database_name>.<schema_name>.<table_name>
   * or for warehouses that don't support schemas:
   * <database_name>.<table_name>
   * @param accountName
   * @param connectionId
   * @param requestBody
   * @returns any Successful Response
   * @throws ApiError
   */
  public coldStartFromTables(
    accountName: string,
    connectionId: string,
    requestBody?: Body_cold_start_from_tables_api_v1_accounts__account_name__star_schema_data_source_cold_start_from_tables_post,
  ): CancelablePromise<Array<any>> {
    return this.httpRequest.request({
      method: 'POST',
      url: '/api/v1/accounts/{account_name}/star_schema_data_source/cold_start_from_tables',
      path: {
        account_name: accountName,
      },
      query: {
        connection_id: connectionId,
      },
      body: requestBody,
      mediaType: 'application/json',
      errors: {
        422: `Validation Error`,
      },
    })
  }

The expected generated code:

  /**
   * Cold Start From Tables
   * Cold start from table.
   *
   * The fully_qualified_table_name is expected to be in the format:
   * <database_name>.<schema_name>.<table_name>
   * or for warehouses that don't support schemas:
   * <database_name>.<table_name>
   * @param accountName
   * @param connectionId
   * @param requestBody
   * @returns any Successful Response
   * @throws ApiError
   */
  public coldStartFromTables(
    accountName: string,
    connectionId: string,
    requestBody?: Body_cold_start_from_tables_api_v1_accounts__account_name__star_schema_data_source_cold_start_from_tables_post,
  ): CancelablePromise<[Task, StarSchemaDataSource]> {
    return this.httpRequest.request({
      method: 'POST',
      url: '/api/v1/accounts/{account_name}/star_schema_data_source/cold_start_from_tables',
      path: {
        account_name: accountName,
      },
      query: {
        connection_id: connectionId,
      },
      body: requestBody,
      mediaType: 'application/json',
      errors: {
        422: `Validation Error`,
      },
    })
  }

Potentially related to #1885 (#1884).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions