OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
20.62k stars 6.29k forks source link

[BUG][TYPESCRIPT] Bug generating type declaration for value type List<SomeType> within a Map. #6749

Open alexg313 opened 4 years ago

alexg313 commented 4 years ago

Bug Report Checklist

Description

Error resolving $ref pointer "https://apitools.dev/swagger-parser/online/#/definitions/List". Token "List" does not exist.

Unable to generate typescript client due to the following Error: model/NotificationEvents.ts:16:40 - error TS2694: Namespace '../dist/otr-ts-client/model/models"' has no exported member 'List'.

The result type is.

export interface NotificationEvents {
    "events"?: { [key: string]: models.List; };
    "totalUnreadCount"?: number;
}
openapi-generator version

openapi-generator-cli 4.3.1 commit : 003165c built : 2020-05-06T09:38:39Z

OpenAPI declaration file content or url
NotificationEvents":{"properties":{"events":{"type":"object","additionalProperties":{"$ref":"#/definitions/List"}},"totalUnreadCount":{"type":"integer","format":"int64"}}}
Command line used for generation

openapi-generator generate -i api/otr-service.json -g typescript-angularjs -o dist/otr-ts-client"

Steps to reproduce

After adding @types/angular as a dependency, I just ran the command below

tsc index.ts

Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/2336

auto-labeler[bot] commented 4 years ago

👍 Thanks for opening this issue! 🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.