swagger-api / swagger-api/swagger-codegen
TypeScript code generation for OpenApi 3 has no post parameter (requestBody) in 3.0.0 branch
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
the generated code has no post parameter
Swagger-codegen version
v 3
Swagger declaration file content or url
OpenApi 3 excerpt
paths:
/login:
post:
requestBody:
description: The email/password
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Login'
generated code excerpt
public loginPost(observe?: 'body', reportProgress?: boolean): Observable<LoginUser>;
public loginPost(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<LoginUser>>;
public loginPost(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<LoginUser>>;
public loginPost(observe: any = 'body', reportProgress: boolean = false): Observable<any> {
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/json'
];
let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set("Accept", httpHeaderAcceptSelected);
}
// to determine the Content-Type header
let consumes: string[] = [
'application/json'
];
return this.httpClient.post<LoginUser>(`${this.basePath}/login`,
null, // HERE is something missing
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
Search for '// HERE is something missing'
Command line used for generation
java -jar swagger-codegen-cli-3.0.0-20180106.033640-15.jar generate -i api.yaml -l typescript-angular -o ./client
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
Start with the OpenAPI excerpt in api.yaml and the typescript-angular generation entry point used by the documented command. Search the generated client for '// HERE is something missing' and trace how requestBody data reaches the POST call. Done means the generated login method accepts and passes the request body instead of emitting null.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100