swagger-api / swagger-api/swagger-codegen

[Typescript] Multiple interface inheritance broken

Open
#10,905 1 comment 1 reaction 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

Issue was introduced from version 2.4.14 to 2.4.15.
2.4.14: Swagger 2.0 type refs were resolved correctly and members from multiple refs were pasted into the generated interface.
2.4.15: Refs are now translated as interface extensions but with multiple refs only one interface is extended

E.g.

UserPermissions:
   type: object
   allOf:
     - $ref: "#/definitions/PermissionUser"
     - $ref: "../definitions/authz.yml#/definitions/PermissionsWithChanges"

translates to

export interface UserPermissions extends PermissionUser {
}
Swagger-codegen version

2.4.15

Command line used for generation
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli:2.4.15 generate -i $BASE_URL/swagger.yml -l typescript-aurelia -o /local/swagger-typescript-client --additional-properties modelPropertyNaming=original,interface-only=true -DsupportingFiles -Dmodels
Steps to reproduce

Run swagger codegen for types with multiple refs

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

Reproduce the issue with the provided Docker command and a Swagger definition containing multiple allOf refs. Trace the typescript-aurelia generator's handling of those refs; done means the generated interface extends every referenced interface rather than only the first one, with a regression test covering the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.