swagger-api / swagger-api/swagger-codegen

[typescript-angular] some models missing from api/*.service.ts imports -- 2.3.0

Open
#7,189 1 comment 0 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

additionalProperties models are not imported in generated typescript-angular api/*.service.ts files.

Swagger-codegen version

2.3.0

Swagger declaration file content or url
"responses": {
    "200": {
        "description": "OK",
        "schema": {
            "type": "object",
            "additionalProperties": {
                "type": "array",
                "items": {
                    "$ref": "#/definitions/MissingInServiceImports"
                }
            }
        }
    }
}

Entire swagger declaration file in this repo: https://github.com/jacksloan/broken-imports-typescript-codegen

Command line used for generation
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
    -i swagger-spec.json \
    -l typescript-angular \
    --additional-properties npmRepository=https://nexus.xyz.com/repository/npm-internal \
    --additional-properties npmName=codegen-xyz \
    --additional-properties npmVersion=0.0.1 \
    --additional-properties ngVersion=4.3.0
Steps to reproduce

Run typescript-angular codegen against the spec file here: https://github.com/jacksloan/broken-imports-typescript-codegen

Snapshot used: https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/2.3.0-SNAPSHOT/swagger-codegen-cli-2.3.0-20171216.033217-359.jar

Related issues/PRs

--

Suggest a fix/enhancement

I'll see what I can come up with. As a guess, could it be related to line 67-71 here?
https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java

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 TypeScriptAngularClientCodegen.java around the referenced lines 67-71, then run the provided swagger-codegen command against the linked swagger-spec.json. Compare the generated typescript-angular api/*.service.ts files with the referenced definition and ensure models used through additionalProperties are imported.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, java, typescript
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.