swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

[typescript-axios] query property renamed to _query

Open robertkowalski opened this issue 1 year ago • 0 comments

Description

We use swagger-codegen and have a property query, but in the Typescript export it is renamed to _query. With previous versions it worked.

Swagger-codegen version

3.0.55, seems to be a regression

Swagger declaration file content or url
openapi: 3.0.0
info:
  title: Test Schema Bugreport
  version: 1.19.1

paths:
  /api/test:
    post:
      summary: Send a event
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: 'array'
              items:
                oneOf:
                  - $ref: '#/components/schemas/BasicEvent'
      responses:
        '200':
          description: The request was successful
components:
  schemas:
    BasicEvent:
      type: object
      required:
      description: |
        A basic description of an event.
      properties:
        query:
          title: Query
          type: string
          format: ^([^=&]+=[^=&]*)(&([^=&]+=[^=&]*)?)*$
          description: A query-formatted and url encoded string to provide attributes. Multiple values for one parameter should be separated with a encoded comma (e.g. "a%2Cb" for the values a and b).
          example: '?foo=bar&xyz=12%263&csv=a%2Cb'

Command line used for generation
swagger-codegen generate -i schema.yaml -l typescript-axios -o out
Steps to reproduce
  1. Run swagger-codegen
  2. inspect result, _query? should be query?:
/* tslint:disable */
/* eslint-disable */
/**
 * Test Schema Bugreport
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: 1.19.1
 * 
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

 /**
 * A basic description of an event. 
 *
 * @export
 * @interface BasicEvent
 */
export interface BasicEvent {

    /**
     * A query-formatted and url encoded string to provide attributes. Multiple values for one parameter should be separated with a encoded comma (e.g. \"a%2Cb\" for the values a and b).
     *
     * @type {string}
     * @memberof BasicEvent
     * @example ?foo=bar&xyz=12%263&csv=a%2Cb
     */
    _query?: string;
}
Related issues/PRs
Suggest a fix/enhancement

robertkowalski avatar Apr 29 '24 10:04 robertkowalski