-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support derived types in request body #110
Comments
@arkraft |
@Manweill Yes sure, i can take a look at it. But i won't be able to do so till Monday. |
@arkraft public createAsync(body?: Body1, observe?: 'body', reportProgress?: boolean): Observable<CustomerDto>;
public createAsync(body?: Body1, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<CustomerDto>>;
public createAsync(body?: Body1, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<CustomerDto>>;
public createAsync(body?: Body1, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'text/plain',
'application/json',
'text/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
'application/json-patch+json',
'application/json',
'text/json',
'application/_*+json'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.request<CustomerDto>('post',`${this.basePath}/api/app/customer`,
{
body: body,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
} Not sure why it's called Body1. However the generated code looks fine aswell: import { CreateUpdateCompanyDto } from './createUpdateCompanyDto';
import { CreateUpdateContactDto } from './createUpdateContactDto';
export type Body1 = CreateUpdateCompanyDto | CreateUpdateContactDto; |
When I use the following json:
The generated code has an empty request body:
Is it possible to add support for derived types, or is it already supported and I am missing something here ?
The text was updated successfully, but these errors were encountered: