forked from loafle/openapi-generator-original
minor fixes to ts nestjs generator (#8622)
This commit is contained in:
parent
e6cee8eb71
commit
c33b5a66e7
@ -1,6 +1,7 @@
|
||||
generatorName: typescript-nestjs
|
||||
outputDir: samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-nestjs
|
||||
additionalProperties:
|
||||
nestVersion: 6.0.0
|
||||
"npmName": "@openapitools/typescript-nestjs-petstore"
|
||||
|
@ -107,7 +107,7 @@ export class {{classname}} {
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
if ({{paramName}} !== undefined && {{paramName}} !== null) {
|
||||
headers['{{baseName}}'] String({{paramName}});
|
||||
headers['{{baseName}}'] = String({{paramName}});
|
||||
}
|
||||
{{/isListContainer}}
|
||||
{{/headerParams}}
|
||||
@ -147,7 +147,7 @@ export class {{classname}} {
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
{{#produces}}
|
||||
'{{{mediaType}}}'{{#hasMore}},{{/hasMore}}
|
||||
'{{{mediaType}}}'{{^-last}},{{/-last}}
|
||||
{{/produces}}
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@ -158,7 +158,7 @@ export class {{classname}} {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
{{#consumes}}
|
||||
'{{{mediaType}}}'{{#hasMore}},{{/hasMore}}
|
||||
'{{{mediaType}}}'{{^-last}},{{/-last}}
|
||||
{{/consumes}}
|
||||
];
|
||||
{{#bodyParam}}
|
||||
@ -167,8 +167,8 @@ export class {{classname}} {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
{{/bodyParam}}
|
||||
|
||||
{{#hasFormParams}}
|
||||
|
||||
const canConsumeForm = this.canConsumeForm(consumes);
|
||||
|
||||
let formParams: { append(param: string, value: any): void; };
|
||||
@ -176,6 +176,7 @@ export class {{classname}} {
|
||||
let convertFormParamsToString = false;
|
||||
{{#formParams}}
|
||||
{{#isFile}}
|
||||
|
||||
// use FormData to transmit files using content-type "multipart/form-data"
|
||||
// see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
|
||||
useForm = canConsumeForm;
|
||||
@ -186,8 +187,8 @@ export class {{classname}} {
|
||||
} else {
|
||||
// formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
|
||||
}
|
||||
|
||||
{{#formParams}}
|
||||
|
||||
{{#isListContainer}}
|
||||
if ({{paramName}}) {
|
||||
{{#isCollectionFormatMulti}}
|
||||
|
@ -67,7 +67,7 @@ export class PetService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@ -77,14 +77,13 @@ export class PetService {
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
'application/json',
|
||||
'application/xml'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.post<Pet>(`${this.basePath}/pet`,
|
||||
pet,
|
||||
{
|
||||
@ -111,7 +110,7 @@ export class PetService {
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
if (apiKey !== undefined && apiKey !== null) {
|
||||
headers['api_key'] String(apiKey);
|
||||
headers['api_key'] = String(apiKey);
|
||||
}
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
@ -133,7 +132,6 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.delete<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@ -172,7 +170,7 @@ export class PetService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@ -183,7 +181,6 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByStatus`,
|
||||
{
|
||||
params: queryParameters,
|
||||
@ -223,7 +220,7 @@ export class PetService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@ -234,7 +231,6 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByTags`,
|
||||
{
|
||||
params: queryParameters,
|
||||
@ -266,7 +262,7 @@ export class PetService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@ -277,7 +273,6 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<Pet>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@ -311,7 +306,7 @@ export class PetService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@ -321,14 +316,13 @@ export class PetService {
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
'application/json',
|
||||
'application/xml'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.put<Pet>(`${this.basePath}/pet`,
|
||||
pet,
|
||||
{
|
||||
@ -392,6 +386,7 @@ export class PetService {
|
||||
if (name !== undefined) {
|
||||
formParams.append('name', <any>name);
|
||||
}
|
||||
|
||||
if (status !== undefined) {
|
||||
formParams.append('status', <any>status);
|
||||
}
|
||||
@ -451,6 +446,7 @@ export class PetService {
|
||||
let formParams: { append(param: string, value: any): void; };
|
||||
let useForm = false;
|
||||
let convertFormParamsToString = false;
|
||||
|
||||
// use FormData to transmit files using content-type "multipart/form-data"
|
||||
// see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
|
||||
useForm = canConsumeForm;
|
||||
@ -463,6 +459,7 @@ export class PetService {
|
||||
if (additionalMetadata !== undefined) {
|
||||
formParams.append('additionalMetadata', <any>additionalMetadata);
|
||||
}
|
||||
|
||||
if (file !== undefined) {
|
||||
formParams.append('file', <any>file);
|
||||
}
|
||||
|
@ -67,7 +67,6 @@ export class StoreService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.delete<any>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@ -103,7 +102,6 @@ export class StoreService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@ -129,7 +127,7 @@ export class StoreService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@ -140,7 +138,6 @@ export class StoreService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<Order>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@ -166,7 +163,7 @@ export class StoreService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@ -182,7 +179,6 @@ export class StoreService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.post<Order>(`${this.basePath}/store/order`,
|
||||
order,
|
||||
{
|
||||
|
@ -77,7 +77,6 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/user`,
|
||||
user,
|
||||
{
|
||||
@ -123,7 +122,6 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/user/createWithArray`,
|
||||
user,
|
||||
{
|
||||
@ -169,7 +167,6 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/user/createWithList`,
|
||||
user,
|
||||
{
|
||||
@ -210,7 +207,6 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.delete<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@ -236,7 +232,7 @@ export class UserService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@ -247,7 +243,6 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<User>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@ -286,7 +281,7 @@ export class UserService {
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml'
|
||||
'application/xml',
|
||||
'application/json'
|
||||
];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
@ -297,7 +292,6 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<string>(`${this.basePath}/user/login`,
|
||||
{
|
||||
params: queryParameters,
|
||||
@ -333,7 +327,6 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
|
||||
return this.httpClient.get<any>(`${this.basePath}/user/logout`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
@ -383,7 +376,6 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
|
||||
return this.httpClient.put<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
user,
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user