swagger-api / swagger-api/swagger-codegen

[Typescript Angular] support for wildcard in definition property

Open
#11,938 0 comments 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

When a wildcard is used as property key such as

...
"_dict_person": {
            "properties": {
                "*": {
                    "type": "object",
                    "additionalProperties": {
                        "$ref": "#/definitions/Person"
                    }
                }
            },
            "type": "object"
        },
...

Generated code isn't correct:

...
export interface DictPerson { 
    ?: { [key: string]: Person; };
}
...
Swagger-codegen version

2.4.28

Swagger declaration file content or url

https://gist.github.com/gautierrog/3ec437297f1d43c8b39ea9af3fa9b658

Command line used for generation
java -jar swagger-codegen-cli.jar generate \                                                                                 🐟  
      -l typescript-angular \
      -i http://localhost:5000/api/v1/swagger.json \
      --additional-properties "ngVersion=14.2.7" \
      -o ./sample-client

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

Use the supplied Swagger declaration and the posted typescript-angular generation command to reproduce the invalid ? property. Trace the typescript-angular generator and templates responsible for definition properties; done means the wildcard input produces valid TypeScript without the malformed property name.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, java, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.