Skip to content

Version 13.2.8 generates incorrect TS #1366

@buffet-time

Description

@buffet-time

Issue in version 13.2.8

Context

I'm working on an open source project and we have a C# backend using Swagger and so of course we use this wonderfully helpful package for our development. I am in the process of updating all of our packages and I ran into the issue where bumping this to 13.2.8 causes errors preventing builds.

Errors:

// This is an error appearing on the `.` of `this.request` see below
Expected '=' for property initializer.ts(1442) 

// on the `|` of the same line
',' expected.ts(1005)

// on the closing `>` 
Expression expected.ts(1109)

generated code

Below is the unmodified output from the generated Leaderboards.ts for 13.2.7 and 13.2.8

13.2.7 Working correctly:

/* eslint-disable */
/* tslint:disable */
// @ts-nocheck
/*
 * ---------------------------------------------------------------
 * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API        ##
 * ##                                                           ##
 * ## AUTHOR: acacode                                           ##
 * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
 * ---------------------------------------------------------------
 */

import {
  CreateLeaderboardRequest,
  GetLeaderboardBySlugParams,
  LeaderboardViewModel,
  ListLeaderboardsParams,
  ProblemDetails,
  UpdateLeaderboardRequest,
  ValidationProblemDetails,
} from "./data-contracts";
import { ContentType, HttpClient, RequestParams } from "./http-client";

export class Leaderboards<
  SecurityDataType = unknown,
> extends HttpClient<SecurityDataType> {
  /**
   * No description
   *
   * @tags Leaderboards
   * @name GetLeaderboard
   * @summary Gets a leaderboard by its ID.
   * @request GET:/api/leaderboard/{id}
   * @secure
   * @response `200` `LeaderboardViewModel` OK
   * @response `400` `ProblemDetails` Bad Request
   * @response `404` `void` Not Found
   * @response `500` `void` Internal Server Error
   */
  getLeaderboard = (id: number, params: RequestParams = {}) =>
    this.request<LeaderboardViewModel, ProblemDetails | void>({
      path: `/api/leaderboard/${id}`,
      method: "GET",
      secure: true,
      format: "json",
      ...params,
    });

13.2.8 Generating TS errors:

/* eslint-disable */
/* tslint:disable */
// @ts-nocheck
/*
 * ---------------------------------------------------------------
 * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API        ##
 * ##                                                           ##
 * ## AUTHOR: acacode                                           ##
 * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
 * ---------------------------------------------------------------
 */



import { HttpClient, RequestParams, ContentType, HttpResponse } from "./http-client";
import { UserRole, SortDirection, RunType, CategoryViewModel, ChangePasswordRequest, CreateCategoryRequest, CreateLeaderboardRequest, CreateRunRequest, LeaderboardViewModel, LoginRequest, LoginResponse, ProblemDetails, RecoverAccountRequest, RegisterRequest, RunViewModel, ScoredRunViewModel, TimedRunViewModel, UpdateLeaderboardRequest, UserViewModel, ValidationProblemDetails, BaseRunViewModel, BaseRunViewModelTypeMapping, GetLeaderboardBySlugParams, ListLeaderboardsParams } from "./data-contracts"

export class Leaderboards<SecurityDataType = unknown> extends HttpClient<SecurityDataType>  {

            /**
 * No description
 *
 * @tags Leaderboards
 * @name GetLeaderboard
 * @summary Gets a leaderboard by its ID.
 * @request GET:/api/leaderboard/{id}
 * @secure
 * @response `200` `LeaderboardViewModel` OK
 * @response `400` `ProblemDetails` Bad Request
 * @response `404` `void` Not Found
 * @response `500` `void` Internal Server Error
 */
getLeaderboard: (id: number, params: RequestParams = {}) =>
    this.request<LeaderboardViewModel, ProblemDetails | void>({
        path: `/api/leaderboard/${id}`,
        method: 'GET',
                        secure: true,                format: "json",        ...params,
    }),

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions