swagger-api / swagger-api/swagger-codegen

[typescript-angular] Invalid interface generation for additionalProperties

Open
#9,439 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Generating a typescript-angular client from the following schema results in an invalid interface:

Schema:

GenericMap:
  type: object
  additionalProperties: true

Expected result:

export interface GenericMap { 
  [key: string]: any;
}

Actual result:

export interface GenericMap extends null<String, any> { 
  [key: string]: any;
}
Swagger-codegen version

3.0.8

Related issues/PRs

#4839 #6361 https://github.com/swagger-api/swagger-parser/issues/401

Suggest a fix/enhancement

(Please feel free to close this issue, if it is a duplicate of the aforementioned.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the typescript-angular generation path and reproduce the issue using the supplied GenericMap schema with additionalProperties: true. Compare the generated interface with the expected output, and review related issues #4839, #6361, and swagger-parser issue #401; done means the generated interface no longer extends null<String, any>.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, openapi, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.