swagger-api / swagger-api/swagger-codegen
[typescript-angular] duplicate methods in ApiService
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Simple model Animal:
[
{
"id": 0,
"name": "string",
"scientific_name": "string"
}
]
Produces an angular api.service.ts file with this content:
For each method of List/Retrieve/PartialUpdate/Update/Destroy 4 methods are created, that differs in signature.
apiAnimalsRetrieve:
/**
*
*
* @param id A unique integer value identifying this animal.
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public apiAnimalsRetrieve(id: number, observe?: 'body', reportProgress?: boolean): Observable<Animal>;
public apiAnimalsRetrieve(id: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Animal>>;
public apiAnimalsRetrieve(id: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Animal>>;
public apiAnimalsRetrieve(id: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
All other service methods are created with a duplicate set of properties id2, name2, scientificName2:
/**
*
*
* @param body
* @param id2
* @param name2
* @param scientificName2
* @param id2
* @param name
* @param scientificName
* @param id A unique integer value identifying this animal.
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public apiAnimalsUpdate(body: Animal, id2: number, name2: string, scientificName2: string, id2: number, name: string, scientificName: string, id: number, observe?: 'body', reportProgress?: boolean): Observable<Animal>;
public apiAnimalsUpdate(body: Animal, id2: number, name2: string, scientificName2: string, id2: number, name: string, scientificName: string, id: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Animal>>;
public apiAnimalsUpdate(body: Animal, id2: number, name2: string, scientificName2: string, id2: number, name: string, scientificName: string, id: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Animal>>;
public apiAnimalsUpdate(body: Animal, id2: number, name2: string, scientificName2: string, id2: number, name: string, scientificName: string, id: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
This raises error messages in angular:
Duplicate function implementation.
Duplicate identifier 'id2'.
...
Swagger-codegen version
3.0.21
Swagger declaration file content or url
Swagger schema file:
https://gist.github.com/gthieleb/a6094f05d4a3513be23712ebad7d8820
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
Use the provided Swagger schema and inspect the generated Angular api.service.ts, especially apiAnimalsRetrieve and apiAnimalsUpdate. Trace the generator template or entry point that produces these method signatures, then verify generation no longer emits duplicate methods or parameters and the resulting Angular service has no duplicate-implementation or duplicate-identifier errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100