OpenAPITools / OpenAPITools/openapi-generator
[BUG][TYPESCRIPT] Bug generating type declaration for value type List<SomeType> within a Map.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the supplied openapi-generator command with api/otr-service.json and inspect the generated model/NotificationEvents.ts output. Trace how the additionalProperties $ref for List is resolved in the typescript-angularjs generator. Done means the generated declaration no longer references a nonexistent models.List and the generated TypeScript passes tsc.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100