swagger-api/swagger-codegen-generators

[typescript-axios] incorrect imports in graph-like structures

programmer106 opened this issue · 4 comments

given:

components: 
  schemas: 
     Category:
      x-swagger-router-model: io.swagger.petstore.model.Category
      properties:
        id:
          type: string
        name:
          type: string
          example: Dogs
        subcategories:
          type: array,
          items:
            $ref: '#/components/schemas/Category'
      xml:
        name: category
      type: object

after generation:

/* tslint:disable */
/* eslint-disable */
/**
 * Swagger Petstore - OpenAPI 3.0
 * This is a sample Pet Store Server based on the OpenAPI 3.0 specification.  You can find out more about Swagger at [http://swagger.io](http://swagger.io). In the third iteration of the pet store, we've switched to the design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3. Some useful links: - [The Pet Store repository](https://github.com/swagger-api/swagger-petstore) - [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
 *
 * OpenAPI spec version: 1.0.17
 * Contact: apiteam@swagger.io
 *
 * 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.
 */
import { Category } from './category';
/**
 * 
 * @export
 * @interface Category
 */
export interface Category {
    /**
     * 
     * @type {string}
     * @memberof Category
     */
    id?: string;
    /**
     * 
     * @type {string}
     * @memberof Category
     */
    name?: string;
    /**
     * 
     * @type {Array<Category>}
     * @memberof Category
     */
    subcategories?: Array<Category>;
}

after trying to build got:

models/category.ts:14:10 - error TS2440: Import declaration conflicts with local declaration of 'Category'.

Can't maintain the client-ts layer effectively due to this issue.

Hi,
did you get a solution for this issue?

Thanks

Hi,

did you get a solution for this issue?

Thanks

Eh, no.
Got fired.