Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong type output in typescript-axios #2726

Closed
ds1371dani opened this issue Jul 12, 2021 · 2 comments
Closed

Wrong type output in typescript-axios #2726

ds1371dani opened this issue Jul 12, 2021 · 2 comments

Comments

@ds1371dani
Copy link

Q&A (please complete the following information)

  • OS: Ubuntu
  • Browser: Firefox
  • Version: 89.0.2
  • Method of installation: online editor (https://editor.swagger.io)
  • Swagger-Editor version: online version
  • Swagger/OpenAPI version: OpenAPI 3.0.3

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.3
info:
  title: SwaggerTest
  contact: {}
  version: BETA1
servers:
  - url: 'http://localhost:4010'
    description: mock
paths:
  /users:
    get:
      tags:
        - Users
      summary: GetUsersList
      operationId: GetUsersList
      parameters:
        - name: count
          in: query
          description: ''
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
            minimum: 1
        - name: start_index
          in: query
          description: ''
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
            minimum: 0
        - name: sort_by
          in: query
          schema:
            items:
              $ref: '#/components/schemas/UserSortList'
        - name: group_by
          schema:
            items:
              $ref: '#/components/schemas/UserGroupList'
          in: query
      responses:
        '200':
          description: OK
          headers: {}
          content:
            application/json:
              schema:
                type: array
                nullable: true
                items:
                  $ref: '#/components/schemas/UserList'
              examples:
                FirstFetch:
                  value:
                    - key: a84b5ff9-f2df-4f86-85a7-64bd2b998193
                      FullName: 'AdminName'
                      Status: Active
                      JobTitle: 'AdminJobTitle'
                    - key: 1d0108ee-fa22-4977-a663-fe50eb5390fc
                      FullName: 'EmployeeName'
                      Status: Active
                      JobTitle: 'EmployeeJobTitle'
                NewEmployee:
                  value:
                    - key: 4d1cb837-4fa1-478a-9fde-82efa1f73cb6
                      FullName: 'NewEmployeeName'
                      Status: New
                      JobTitle: 'NewEmployeeJobTitle'
                'NULL':
                  value: null
                Empty:
                  value: []
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '500':
          description: Internal Server Error
      deprecated: false
      description: Get list of organization users.
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
  schemas:
    UserList:
      type: object
      title: UserList
      example:
        key: a84b5ff9-f2df-4f86-85a7-64bd2b998193
        FullName: 'AdminName'
        Status: Active
        JobTitle: 'AdminJobTitle'
      description: ''
      additionalProperties: false
      nullable: true
      properties:
        key:
          type: string
          format: uuid
        FullName:
          type: string
        Status:
          $ref: '#/components/schemas/UserStatus'
        JobTitle:
          type: string
      required:
        - key
        - FullName
        - Status
        - JobTitle
      readOnly: true
    UserStatus:
      type: string
      enum:
        - Active
        - New
        - Suspend
      x-tags:
        - enums
    UserSortList:
      type: string
      x-tags:
        - enums
      enum:
        - Date
        - Balance
    UserGroupList:
      type: string
      x-tags:
        - enums
      enum:
        - Employee
        - Employer
security:
  - bearerAuth: []
tags:
  - name: Users

Describe the bug you're encountering

Generating typescript-fetch client outputs correct types but typescript-axios replaces every type with any

To reproduce...

Steps to reproduce the behavior:

  1. Go to https://editor.swagger.io
  2. Add the yaml data
  3. Generate client (typescript-axios)
  4. Open models > user-list.ts file
  5. Every type is any

Expected behavior

The types should not be any

Screenshots

Screenshot from 2021-07-12 13-44-24

Additional context or thoughts

@frantuma
Copy link
Member

Code generation functionality of editor is provided by swagger codegen, I would kindly ask you to move this issue to codegen repo instead.

@ds1371dani
Copy link
Author

Thanks for answering,
I checked it's issues it seems there is an open issue for it already at here.

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

No branches or pull requests

2 participants