mirror of
https://github.com/ferdikoomen/openapi-typescript-codegen.git
synced 2025-12-08 20:16:21 +00:00
- Fixed #233
This commit is contained in:
parent
3664a6562b
commit
8a3102b0b1
2
src/client/interfaces/Model.d.ts
vendored
2
src/client/interfaces/Model.d.ts
vendored
@ -9,7 +9,7 @@ export interface Model extends Schema {
|
||||
template: string | null;
|
||||
link: Model | null;
|
||||
description: string | null;
|
||||
default?: any;
|
||||
default?: string;
|
||||
imports: string[];
|
||||
extends: string[];
|
||||
enum: Enum[];
|
||||
|
||||
@ -53,7 +53,6 @@ export function getOperationParameter(openApi: OpenApi, parameter: OpenApiParame
|
||||
operationParameter.template = definitionRef.template;
|
||||
operationParameter.imports.push(...definitionRef.imports);
|
||||
operationParameter.default = getOperationParameterDefault(parameter, operationParameter);
|
||||
operationParameter.isRequired = operationParameter.isRequired || operationParameter.default;
|
||||
return operationParameter;
|
||||
}
|
||||
|
||||
@ -66,7 +65,6 @@ export function getOperationParameter(openApi: OpenApi, parameter: OpenApiParame
|
||||
operationParameter.base = PrimaryType.STRING;
|
||||
operationParameter.enum.push(...extendedEnumerators);
|
||||
operationParameter.default = getOperationParameterDefault(parameter, operationParameter);
|
||||
operationParameter.isRequired = operationParameter.isRequired || operationParameter.default;
|
||||
return operationParameter;
|
||||
}
|
||||
}
|
||||
@ -79,7 +77,6 @@ export function getOperationParameter(openApi: OpenApi, parameter: OpenApiParame
|
||||
operationParameter.base = PrimaryType.NUMBER;
|
||||
operationParameter.enum.push(...enumerators);
|
||||
operationParameter.default = getOperationParameterDefault(parameter, operationParameter);
|
||||
operationParameter.isRequired = operationParameter.isRequired || operationParameter.default;
|
||||
return operationParameter;
|
||||
}
|
||||
}
|
||||
@ -92,7 +89,6 @@ export function getOperationParameter(openApi: OpenApi, parameter: OpenApiParame
|
||||
operationParameter.template = items.template;
|
||||
operationParameter.imports.push(...items.imports);
|
||||
operationParameter.default = getOperationParameterDefault(parameter, operationParameter);
|
||||
operationParameter.isRequired = operationParameter.isRequired || operationParameter.default;
|
||||
return operationParameter;
|
||||
}
|
||||
|
||||
@ -105,7 +101,6 @@ export function getOperationParameter(openApi: OpenApi, parameter: OpenApiParame
|
||||
operationParameter.imports.push(...items.imports);
|
||||
operationParameter.imports.push('Dictionary');
|
||||
operationParameter.default = getOperationParameterDefault(parameter, operationParameter);
|
||||
operationParameter.isRequired = operationParameter.isRequired || operationParameter.default;
|
||||
return operationParameter;
|
||||
}
|
||||
|
||||
@ -118,7 +113,6 @@ export function getOperationParameter(openApi: OpenApi, parameter: OpenApiParame
|
||||
operationParameter.template = model.template;
|
||||
operationParameter.imports.push(...model.imports);
|
||||
operationParameter.default = getOperationParameterDefault(parameter, operationParameter);
|
||||
operationParameter.isRequired = operationParameter.isRequired || operationParameter.default;
|
||||
return operationParameter;
|
||||
} else {
|
||||
const model = getModel(openApi, parameter.schema);
|
||||
@ -133,7 +127,6 @@ export function getOperationParameter(openApi: OpenApi, parameter: OpenApiParame
|
||||
operationParameter.enums.push(...model.enums);
|
||||
operationParameter.properties.push(...model.properties);
|
||||
operationParameter.default = getOperationParameterDefault(parameter, operationParameter);
|
||||
operationParameter.isRequired = operationParameter.isRequired || operationParameter.default;
|
||||
return operationParameter;
|
||||
}
|
||||
}
|
||||
@ -147,7 +140,6 @@ export function getOperationParameter(openApi: OpenApi, parameter: OpenApiParame
|
||||
operationParameter.template = definitionType.template;
|
||||
operationParameter.imports.push(...definitionType.imports);
|
||||
operationParameter.default = getOperationParameterDefault(parameter, operationParameter);
|
||||
operationParameter.isRequired = operationParameter.isRequired || operationParameter.default;
|
||||
return operationParameter;
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { OperationParameter } from '../../../client/interfaces/OperationParameter';
|
||||
import { OpenApiParameter } from '../interfaces/OpenApiParameter';
|
||||
|
||||
export function getOperationParameterDefault(parameter: OpenApiParameter, operationParameter: OperationParameter): string | null {
|
||||
export function getOperationParameterDefault(parameter: OpenApiParameter, operationParameter: OperationParameter): string | undefined {
|
||||
if (parameter.default === null) {
|
||||
return 'null';
|
||||
}
|
||||
@ -27,5 +27,5 @@ export function getOperationParameterDefault(parameter: OpenApiParameter, operat
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,5 +1,27 @@
|
||||
import { OperationParameter } from '../../../client/interfaces/OperationParameter';
|
||||
|
||||
/**
|
||||
* Sort by required and default values creating the following order:
|
||||
* 1. Parameters that are required and have no default value
|
||||
* 2. Parameters that are optional and have no default value
|
||||
* 3. Parameters that are required and have a default value
|
||||
* 4. Parameters that are optional and have a default value
|
||||
*
|
||||
* Resulting in the following order:
|
||||
*
|
||||
* function myFunction(param1: string, param2?: string, param3: string = 'hello') {
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
*/
|
||||
export function sortByRequired(a: OperationParameter, b: OperationParameter): number {
|
||||
return a.isRequired && !b.isRequired ? -1 : !a.isRequired && b.isRequired ? 1 : 0;
|
||||
const aHasDefaultValue = a.default !== undefined;
|
||||
const bHasDefaultValue = b.default !== undefined;
|
||||
if (aHasDefaultValue && !bHasDefaultValue) return 1;
|
||||
if (!aHasDefaultValue && bHasDefaultValue) return -1;
|
||||
if (a.isRequired && !b.isRequired) return -1;
|
||||
if (!a.isRequired && b.isRequired) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Model } from '../../../client/interfaces/Model';
|
||||
import { OpenApiSchema } from '../interfaces/OpenApiSchema';
|
||||
|
||||
export function getModelDefault(definition: OpenApiSchema, model?: Model): string | null {
|
||||
export function getModelDefault(definition: OpenApiSchema, model?: Model): string | undefined {
|
||||
if (definition.default === null) {
|
||||
return 'null';
|
||||
}
|
||||
@ -27,5 +27,5 @@ export function getModelDefault(definition: OpenApiSchema, model?: Model): strin
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ export function getOperationParameter(openApi: OpenApi, parameter: OpenApiParame
|
||||
operationParameter.template = model.template;
|
||||
operationParameter.imports.push(...model.imports);
|
||||
operationParameter.default = getModelDefault(parameter.schema);
|
||||
operationParameter.isRequired = operationParameter.isRequired || operationParameter.default;
|
||||
operationParameter.isRequired = operationParameter.isRequired;
|
||||
return operationParameter;
|
||||
} else {
|
||||
const model = getModel(openApi, parameter.schema);
|
||||
@ -59,7 +59,7 @@ export function getOperationParameter(openApi: OpenApi, parameter: OpenApiParame
|
||||
operationParameter.template = model.template;
|
||||
operationParameter.link = model.link;
|
||||
operationParameter.isReadOnly = model.isReadOnly;
|
||||
operationParameter.isRequired = operationParameter.isRequired || model.isRequired || model.default;
|
||||
operationParameter.isRequired = operationParameter.isRequired || model.isRequired;
|
||||
operationParameter.isNullable = operationParameter.isNullable || model.isNullable;
|
||||
operationParameter.format = model.format;
|
||||
operationParameter.maximum = model.maximum;
|
||||
|
||||
@ -1,5 +1,27 @@
|
||||
import { OperationParameter } from '../../../client/interfaces/OperationParameter';
|
||||
|
||||
/**
|
||||
* Sort by required and default values creating the following order:
|
||||
* 1. Parameters that are required and have no default value
|
||||
* 2. Parameters that are optional and have no default value
|
||||
* 3. Parameters that are required and have a default value
|
||||
* 4. Parameters that are optional and have a default value
|
||||
*
|
||||
* Resulting in the following order:
|
||||
*
|
||||
* function myFunction(param1: string, param2?: string, param3: string = 'hello') {
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
*/
|
||||
export function sortByRequired(a: OperationParameter, b: OperationParameter): number {
|
||||
return a.isRequired && !b.isRequired ? -1 : !a.isRequired && b.isRequired ? 1 : 0;
|
||||
const aHasDefaultValue = a.default !== undefined;
|
||||
const bHasDefaultValue = b.default !== undefined;
|
||||
if (aHasDefaultValue && !bHasDefaultValue) return 1;
|
||||
if (!aHasDefaultValue && bHasDefaultValue) return -1;
|
||||
if (a.isRequired && !b.isRequired) return -1;
|
||||
if (!a.isRequired && b.isRequired) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1 +1,5 @@
|
||||
{{#unless isRequired}}?{{/unless}}
|
||||
{{#if @root.useOptions}}
|
||||
{{~#unless isRequired}}?{{else if default}}?{{/unless~}}
|
||||
{{else}}
|
||||
{{~#unless isRequired}}{{#unless default}}?{{/unless}}{{/unless~}}
|
||||
{{/if}}
|
||||
|
||||
@ -1999,11 +1999,11 @@ import { OpenAPI } from '../core/OpenAPI';
|
||||
export class DefaultsService {
|
||||
|
||||
/**
|
||||
* @param parameterString This is a simple string
|
||||
* @param parameterNumber This is a simple number
|
||||
* @param parameterBoolean This is a simple boolean
|
||||
* @param parameterEnum This is a simple enum
|
||||
* @param parameterModel This is a simple model
|
||||
* @param parameterString This is a simple string with default value
|
||||
* @param parameterNumber This is a simple number with default value
|
||||
* @param parameterBoolean This is a simple boolean with default value
|
||||
* @param parameterEnum This is a simple enum with default value
|
||||
* @param parameterModel This is a simple model with default value
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async callWithDefaultParameters({
|
||||
@ -2015,11 +2015,11 @@ export class DefaultsService {
|
||||
\\"prop\\": \\"Hello World\\"
|
||||
},
|
||||
}: {
|
||||
parameterString: string,
|
||||
parameterNumber: number,
|
||||
parameterBoolean: boolean,
|
||||
parameterEnum: ('Success' | 'Warning' | 'Error'),
|
||||
parameterModel: ModelThatExtends | ModelThatExtendsExtends | ModelWithString,
|
||||
parameterString?: string,
|
||||
parameterNumber?: number,
|
||||
parameterBoolean?: boolean,
|
||||
parameterEnum?: ('Success' | 'Warning' | 'Error'),
|
||||
parameterModel?: ModelThatExtends | ModelThatExtendsExtends | ModelWithString,
|
||||
}): Promise<void> {
|
||||
|
||||
const result = await __request({
|
||||
@ -2039,6 +2039,90 @@ export class DefaultsService {
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameterString This is a simple string that is optional with default value
|
||||
* @param parameterNumber This is a simple number that is optional with default value
|
||||
* @param parameterBoolean This is a simple boolean that is optional with default value
|
||||
* @param parameterEnum This is a simple enum that is optional with default value
|
||||
* @param parameterModel This is a simple model that is optional with default value
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async callWithDefaultOptionalParameters({
|
||||
parameterString = 'Hello World!',
|
||||
parameterNumber = 123,
|
||||
parameterBoolean = true,
|
||||
parameterEnum = 'Success',
|
||||
parameterModel = {
|
||||
\\"prop\\": \\"Hello World\\"
|
||||
},
|
||||
}: {
|
||||
parameterString?: string,
|
||||
parameterNumber?: number,
|
||||
parameterBoolean?: boolean,
|
||||
parameterEnum?: ('Success' | 'Warning' | 'Error'),
|
||||
parameterModel?: ModelThatExtends | ModelThatExtendsExtends | ModelWithString,
|
||||
}): Promise<void> {
|
||||
|
||||
const result = await __request({
|
||||
method: 'post',
|
||||
path: \`/api/v\${OpenAPI.VERSION}/defaults\`,
|
||||
query: {
|
||||
'parameterString': parameterString,
|
||||
'parameterNumber': parameterNumber,
|
||||
'parameterBoolean': parameterBoolean,
|
||||
'parameterEnum': parameterEnum,
|
||||
'parameterModel': parameterModel,
|
||||
},
|
||||
});
|
||||
|
||||
catchGenericError(result);
|
||||
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameterStringWithNoDefault This is a string with no default
|
||||
* @param parameterOptionalStringWithNoDefault This is a optional string with no default
|
||||
* @param parameterStringWithDefault This is a string with default
|
||||
* @param parameterStringWithEmptyDefault This is a string with empty default
|
||||
* @param parameterOptionalStringWithDefault This is a optional string with default
|
||||
* @param parameterOptionalStringWithEmptyDefault This is a optional string with empty default
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async callToTestOrderOfParams({
|
||||
parameterStringWithNoDefault,
|
||||
parameterOptionalStringWithNoDefault,
|
||||
parameterStringWithDefault = 'hello',
|
||||
parameterStringWithEmptyDefault = '',
|
||||
parameterOptionalStringWithDefault = 'Hello World!',
|
||||
parameterOptionalStringWithEmptyDefault = '',
|
||||
}: {
|
||||
parameterStringWithNoDefault: string,
|
||||
parameterOptionalStringWithNoDefault?: string,
|
||||
parameterStringWithDefault?: string,
|
||||
parameterStringWithEmptyDefault?: string,
|
||||
parameterOptionalStringWithDefault?: string,
|
||||
parameterOptionalStringWithEmptyDefault?: string,
|
||||
}): Promise<void> {
|
||||
|
||||
const result = await __request({
|
||||
method: 'put',
|
||||
path: \`/api/v\${OpenAPI.VERSION}/defaults\`,
|
||||
query: {
|
||||
'parameterStringWithNoDefault': parameterStringWithNoDefault,
|
||||
'parameterOptionalStringWithNoDefault': parameterOptionalStringWithNoDefault,
|
||||
'parameterStringWithDefault': parameterStringWithDefault,
|
||||
'parameterStringWithEmptyDefault': parameterStringWithEmptyDefault,
|
||||
'parameterOptionalStringWithDefault': parameterOptionalStringWithDefault,
|
||||
'parameterOptionalStringWithEmptyDefault': parameterOptionalStringWithEmptyDefault,
|
||||
},
|
||||
});
|
||||
|
||||
catchGenericError(result);
|
||||
|
||||
return result.body;
|
||||
}
|
||||
|
||||
}"
|
||||
`;
|
||||
|
||||
@ -2476,14 +2560,14 @@ import { OpenAPI } from '../core/OpenAPI';
|
||||
export class TypesService {
|
||||
|
||||
/**
|
||||
* @param parameterNumber This is a number parameter
|
||||
* @param parameterString This is a string parameter
|
||||
* @param parameterBoolean This is a boolean parameter
|
||||
* @param parameterObject This is an object parameter
|
||||
* @param parameterArray This is an array parameter
|
||||
* @param parameterDictionary This is a dictionary parameter
|
||||
* @param parameterEnum This is an enum parameter
|
||||
* @param id This is a number parameter
|
||||
* @param parameterNumber This is a number parameter
|
||||
* @param parameterString This is a string parameter
|
||||
* @param parameterBoolean This is a boolean parameter
|
||||
* @param parameterObject This is an object parameter
|
||||
* @result number Response is a simple number
|
||||
* @result string Response is a simple string
|
||||
* @result boolean Response is a simple boolean
|
||||
@ -2491,36 +2575,36 @@ export class TypesService {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async types({
|
||||
parameterNumber = 123,
|
||||
parameterString = 'default',
|
||||
parameterBoolean = true,
|
||||
parameterObject = null,
|
||||
parameterArray,
|
||||
parameterDictionary,
|
||||
parameterEnum,
|
||||
id,
|
||||
parameterNumber = 123,
|
||||
parameterString = 'default',
|
||||
parameterBoolean = true,
|
||||
parameterObject = null,
|
||||
}: {
|
||||
parameterNumber: number,
|
||||
parameterString: string,
|
||||
parameterBoolean: boolean,
|
||||
parameterObject: any,
|
||||
parameterArray: Array<string>,
|
||||
parameterDictionary: Dictionary<string>,
|
||||
parameterEnum: ('Success' | 'Warning' | 'Error'),
|
||||
id?: number,
|
||||
parameterNumber?: number,
|
||||
parameterString?: string,
|
||||
parameterBoolean?: boolean,
|
||||
parameterObject?: any,
|
||||
}): Promise<number | string | boolean | any> {
|
||||
|
||||
const result = await __request({
|
||||
method: 'get',
|
||||
path: \`/api/v\${OpenAPI.VERSION}/types\`,
|
||||
query: {
|
||||
'parameterArray': parameterArray,
|
||||
'parameterDictionary': parameterDictionary,
|
||||
'parameterEnum': parameterEnum,
|
||||
'parameterNumber': parameterNumber,
|
||||
'parameterString': parameterString,
|
||||
'parameterBoolean': parameterBoolean,
|
||||
'parameterObject': parameterObject,
|
||||
'parameterArray': parameterArray,
|
||||
'parameterDictionary': parameterDictionary,
|
||||
'parameterEnum': parameterEnum,
|
||||
},
|
||||
});
|
||||
|
||||
@ -4660,11 +4744,11 @@ import { OpenAPI } from '../core/OpenAPI';
|
||||
export class DefaultsService {
|
||||
|
||||
/**
|
||||
* @param parameterString This is a simple string
|
||||
* @param parameterNumber This is a simple number
|
||||
* @param parameterBoolean This is a simple boolean
|
||||
* @param parameterEnum This is a simple enum
|
||||
* @param parameterModel This is a simple model
|
||||
* @param parameterString This is a simple string with default value
|
||||
* @param parameterNumber This is a simple number with default value
|
||||
* @param parameterBoolean This is a simple boolean with default value
|
||||
* @param parameterEnum This is a simple enum with default value
|
||||
* @param parameterModel This is a simple model with default value
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async callWithDefaultParameters({
|
||||
@ -4676,11 +4760,11 @@ export class DefaultsService {
|
||||
\\"prop\\": \\"Hello World\\"
|
||||
},
|
||||
}: {
|
||||
parameterString: string | null,
|
||||
parameterNumber: number | null,
|
||||
parameterBoolean: boolean | null,
|
||||
parameterEnum: ('Success' | 'Warning' | 'Error'),
|
||||
parameterModel: ModelThatExtends | ModelThatExtendsExtends | ModelWithString | null,
|
||||
parameterString?: string | null,
|
||||
parameterNumber?: number | null,
|
||||
parameterBoolean?: boolean | null,
|
||||
parameterEnum?: ('Success' | 'Warning' | 'Error'),
|
||||
parameterModel?: ModelThatExtends | ModelThatExtendsExtends | ModelWithString | null,
|
||||
}): Promise<void> {
|
||||
|
||||
const result = await __request({
|
||||
@ -4700,6 +4784,90 @@ export class DefaultsService {
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameterString This is a simple string that is optional with default value
|
||||
* @param parameterNumber This is a simple number that is optional with default value
|
||||
* @param parameterBoolean This is a simple boolean that is optional with default value
|
||||
* @param parameterEnum This is a simple enum that is optional with default value
|
||||
* @param parameterModel This is a simple model that is optional with default value
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async callWithDefaultOptionalParameters({
|
||||
parameterString = 'Hello World!',
|
||||
parameterNumber = 123,
|
||||
parameterBoolean = true,
|
||||
parameterEnum = 'Success',
|
||||
parameterModel = {
|
||||
\\"prop\\": \\"Hello World\\"
|
||||
},
|
||||
}: {
|
||||
parameterString?: string,
|
||||
parameterNumber?: number,
|
||||
parameterBoolean?: boolean,
|
||||
parameterEnum?: ('Success' | 'Warning' | 'Error'),
|
||||
parameterModel?: ModelThatExtends | ModelThatExtendsExtends | ModelWithString,
|
||||
}): Promise<void> {
|
||||
|
||||
const result = await __request({
|
||||
method: 'post',
|
||||
path: \`/api/v\${OpenAPI.VERSION}/defaults\`,
|
||||
query: {
|
||||
'parameterString': parameterString,
|
||||
'parameterNumber': parameterNumber,
|
||||
'parameterBoolean': parameterBoolean,
|
||||
'parameterEnum': parameterEnum,
|
||||
'parameterModel': parameterModel,
|
||||
},
|
||||
});
|
||||
|
||||
catchGenericError(result);
|
||||
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameterStringWithNoDefault This is a string with no default
|
||||
* @param parameterOptionalStringWithNoDefault This is a optional string with no default
|
||||
* @param parameterStringWithDefault This is a string with default
|
||||
* @param parameterStringWithEmptyDefault This is a string with empty default
|
||||
* @param parameterOptionalStringWithDefault This is a optional string with default
|
||||
* @param parameterOptionalStringWithEmptyDefault This is a optional string with empty default
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async callToTestOrderOfParams({
|
||||
parameterStringWithNoDefault,
|
||||
parameterOptionalStringWithNoDefault,
|
||||
parameterStringWithDefault = 'hello',
|
||||
parameterStringWithEmptyDefault = '',
|
||||
parameterOptionalStringWithDefault = 'hello',
|
||||
parameterOptionalStringWithEmptyDefault = '',
|
||||
}: {
|
||||
parameterStringWithNoDefault: string,
|
||||
parameterOptionalStringWithNoDefault?: string,
|
||||
parameterStringWithDefault?: string,
|
||||
parameterStringWithEmptyDefault?: string,
|
||||
parameterOptionalStringWithDefault?: string,
|
||||
parameterOptionalStringWithEmptyDefault?: string,
|
||||
}): Promise<void> {
|
||||
|
||||
const result = await __request({
|
||||
method: 'put',
|
||||
path: \`/api/v\${OpenAPI.VERSION}/defaults\`,
|
||||
query: {
|
||||
'parameterStringWithNoDefault': parameterStringWithNoDefault,
|
||||
'parameterOptionalStringWithNoDefault': parameterOptionalStringWithNoDefault,
|
||||
'parameterStringWithDefault': parameterStringWithDefault,
|
||||
'parameterStringWithEmptyDefault': parameterStringWithEmptyDefault,
|
||||
'parameterOptionalStringWithDefault': parameterOptionalStringWithDefault,
|
||||
'parameterOptionalStringWithEmptyDefault': parameterOptionalStringWithEmptyDefault,
|
||||
},
|
||||
});
|
||||
|
||||
catchGenericError(result);
|
||||
|
||||
return result.body;
|
||||
}
|
||||
|
||||
}"
|
||||
`;
|
||||
|
||||
@ -5242,14 +5410,14 @@ import { OpenAPI } from '../core/OpenAPI';
|
||||
export class TypesService {
|
||||
|
||||
/**
|
||||
* @param parameterNumber This is a number parameter
|
||||
* @param parameterString This is a string parameter
|
||||
* @param parameterBoolean This is a boolean parameter
|
||||
* @param parameterObject This is an object parameter
|
||||
* @param parameterArray This is an array parameter
|
||||
* @param parameterDictionary This is a dictionary parameter
|
||||
* @param parameterEnum This is an enum parameter
|
||||
* @param id This is a number parameter
|
||||
* @param parameterNumber This is a number parameter
|
||||
* @param parameterString This is a string parameter
|
||||
* @param parameterBoolean This is a boolean parameter
|
||||
* @param parameterObject This is an object parameter
|
||||
* @result number Response is a simple number
|
||||
* @result string Response is a simple string
|
||||
* @result boolean Response is a simple boolean
|
||||
@ -5257,36 +5425,36 @@ export class TypesService {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async types({
|
||||
parameterNumber = 123,
|
||||
parameterString = 'default',
|
||||
parameterBoolean = true,
|
||||
parameterObject = null,
|
||||
parameterArray,
|
||||
parameterDictionary,
|
||||
parameterEnum,
|
||||
id,
|
||||
parameterNumber = 123,
|
||||
parameterString = 'default',
|
||||
parameterBoolean = true,
|
||||
parameterObject = null,
|
||||
}: {
|
||||
parameterNumber: number,
|
||||
parameterString: string | null,
|
||||
parameterBoolean: boolean | null,
|
||||
parameterObject: any,
|
||||
parameterArray: Array<string> | null,
|
||||
parameterDictionary: any,
|
||||
parameterEnum: ('Success' | 'Warning' | 'Error') | null,
|
||||
id?: number,
|
||||
parameterNumber?: number,
|
||||
parameterString?: string | null,
|
||||
parameterBoolean?: boolean | null,
|
||||
parameterObject?: any,
|
||||
}): Promise<number | string | boolean | any> {
|
||||
|
||||
const result = await __request({
|
||||
method: 'get',
|
||||
path: \`/api/v\${OpenAPI.VERSION}/types\`,
|
||||
query: {
|
||||
'parameterArray': parameterArray,
|
||||
'parameterDictionary': parameterDictionary,
|
||||
'parameterEnum': parameterEnum,
|
||||
'parameterNumber': parameterNumber,
|
||||
'parameterString': parameterString,
|
||||
'parameterBoolean': parameterBoolean,
|
||||
'parameterObject': parameterObject,
|
||||
'parameterArray': parameterArray,
|
||||
'parameterDictionary': parameterDictionary,
|
||||
'parameterEnum': parameterEnum,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -171,28 +171,86 @@
|
||||
"operationId": "CallWithDefaultParameters",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "This is a simple string",
|
||||
"description": "This is a simple string with default value",
|
||||
"name": "parameterString",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"default": "Hello World!",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"description": "This is a simple number with default value",
|
||||
"name": "parameterNumber",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"default": 123,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"description": "This is a simple boolean with default value",
|
||||
"name": "parameterBoolean",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"description": "This is a simple enum with default value",
|
||||
"name": "parameterEnum",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"default": 0,
|
||||
"schema": {
|
||||
"enum": [
|
||||
"Success",
|
||||
"Warning",
|
||||
"Error"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a simple model with default value",
|
||||
"name": "parameterModel",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"default": {
|
||||
"prop": "Hello World"
|
||||
},
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ModelWithString"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"tags": [
|
||||
"Defaults"
|
||||
],
|
||||
"operationId": "CallWithDefaultOptionalParameters",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "This is a simple string that is optional with default value",
|
||||
"name": "parameterString",
|
||||
"in": "query",
|
||||
"default": "Hello World!",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"description": "This is a simple number",
|
||||
"description": "This is a simple number that is optional with default value",
|
||||
"name": "parameterNumber",
|
||||
"in": "query",
|
||||
"default": 123,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"description": "This is a simple boolean",
|
||||
"description": "This is a simple boolean that is optional with default value",
|
||||
"name": "parameterBoolean",
|
||||
"in": "query",
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"description": "This is a simple enum",
|
||||
"description": "This is a simple enum that is optional with default value",
|
||||
"name": "parameterEnum",
|
||||
"in": "query",
|
||||
"default": 0,
|
||||
@ -205,7 +263,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a simple model",
|
||||
"description": "This is a simple model that is optional with default value",
|
||||
"name": "parameterModel",
|
||||
"in": "query",
|
||||
"default": {
|
||||
@ -216,6 +274,60 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"tags": [
|
||||
"Defaults"
|
||||
],
|
||||
"operationId": "CallToTestOrderOfParams",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "This is a optional string with default",
|
||||
"name": "parameterOptionalStringWithDefault",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"default": "Hello World!",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"description": "This is a optional string with empty default",
|
||||
"name": "parameterOptionalStringWithEmptyDefault",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"default": "",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"description": "This is a optional string with no default",
|
||||
"name": "parameterOptionalStringWithNoDefault",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"description": "This is a string with default",
|
||||
"name": "parameterStringWithDefault",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"default": "hello",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"description": "This is a string with empty default",
|
||||
"name": "parameterStringWithEmptyDefault",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"default": "",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"description": "This is a string with no default",
|
||||
"name": "parameterStringWithNoDefault",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v{api-version}/duplicate": {
|
||||
|
||||
@ -296,7 +296,7 @@
|
||||
"operationId": "CallWithDefaultParameters",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "This is a simple string",
|
||||
"description": "This is a simple string with default value",
|
||||
"name": "parameterString",
|
||||
"in": "query",
|
||||
"nullable": true,
|
||||
@ -306,7 +306,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a simple number",
|
||||
"description": "This is a simple number with default value",
|
||||
"name": "parameterNumber",
|
||||
"in": "query",
|
||||
"nullable": true,
|
||||
@ -316,7 +316,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a simple boolean",
|
||||
"description": "This is a simple boolean with default value",
|
||||
"name": "parameterBoolean",
|
||||
"in": "query",
|
||||
"nullable": true,
|
||||
@ -326,7 +326,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a simple enum",
|
||||
"description": "This is a simple enum with default value",
|
||||
"name": "parameterEnum",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
@ -339,7 +339,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a simple model",
|
||||
"description": "This is a simple model with default value",
|
||||
"name": "parameterModel",
|
||||
"in": "query",
|
||||
"nullable": true,
|
||||
@ -351,6 +351,136 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"tags": [
|
||||
"Defaults"
|
||||
],
|
||||
"operationId": "CallWithDefaultOptionalParameters",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "This is a simple string that is optional with default value",
|
||||
"name": "parameterString",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"default": "Hello World!"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a simple number that is optional with default value",
|
||||
"name": "parameterNumber",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "number",
|
||||
"default": 123
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a simple boolean that is optional with default value",
|
||||
"name": "parameterBoolean",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a simple enum that is optional with default value",
|
||||
"name": "parameterEnum",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"enum": [
|
||||
"Success",
|
||||
"Warning",
|
||||
"Error"
|
||||
],
|
||||
"default": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a simple model that is optional with default value",
|
||||
"name": "parameterModel",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ModelWithString",
|
||||
"default": {
|
||||
"prop": "Hello World"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"tags": [
|
||||
"Defaults"
|
||||
],
|
||||
"operationId": "CallToTestOrderOfParams",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "This is a optional string with default",
|
||||
"name": "parameterOptionalStringWithDefault",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"default": "hello"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a optional string with empty default",
|
||||
"name": "parameterOptionalStringWithEmptyDefault",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a optional string with no default",
|
||||
"name": "parameterOptionalStringWithNoDefault",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a string with default",
|
||||
"name": "parameterStringWithDefault",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"default": "hello"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a string with empty default",
|
||||
"name": "parameterStringWithEmptyDefault",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "This is a string with no default",
|
||||
"name": "parameterStringWithNoDefault",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v{api-version}/duplicate": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user