Skip to content

[BUG] [typescript] Importing non-existent file #22276

@chang-ph

Description

@chang-ph

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

the generated typescript code imports a non-existent file:

import { Null } from '../models/Null';   // <<<<< this file does not exist. generator verion 7.16 doesn't generate this line.
import { HttpFile } from '../http/http';

export class SuccRspNoneType {
    'status': SuccRspNoneTypeStatusEnum;
    'data': Null;

    static readonly discriminator: string | undefined = undefined;

    static readonly mapping: {[index: string]: string} | undefined = undefined;

    static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
        {
            "name": "status",
            "baseName": "status",
            "type": "SuccRspNoneTypeStatusEnum",
            "format": ""
        },
        {
            "name": "data",
            "baseName": "data",
            "type": "Null",
            "format": ""
        }    ];

    static getAttributeTypeMap() {
        return SuccRspNoneType.attributeTypeMap;
    }

    public constructor() {
    }
}

export enum SuccRspNoneTypeStatusEnum {
    Ok = 'ok'
}
openapi-generator version

7.17.0

OpenAPI declaration file content or url
[...]
"SuccRsp_NoneType_": {
  "properties": {
    "status": {
      "const": "ok",
      "title": "Status",
      "type": "string"
    },
    "data": {
      "title": "Data",         
      "type": "null" 
    }
  },        
  "required": [
    "status",
    "data"
  ],
  "title": "SuccRsp[NoneType]",
  "type": "object"
},
[...]
Steps to reproduce

openapi-generator-cli generate -g typescript -i openapi.json -o typescript/sdk

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions