forked from loafle/openapi-generator-original
[typescript-axios] Add stringEnums option (#11368)
* add stringEnums option * update templates * add export * update samples * update document * improve readability * remove unnecessary code * add config file for sample * add sample * update sample * remove enum variable form modelObjetEnum template because this variable is not used in modelStringEnum template. * change the indentation to be the same as modelGeneric template
This commit is contained in:
parent
b901f11e85
commit
088c65c9c6
6
bin/configs/typescript-axios-with-string-enums.yaml
Normal file
6
bin/configs/typescript-axios-with-string-enums.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
generatorName: typescript-axios
|
||||
outputDir: samples/client/petstore/typescript-axios/builds/with-string-enums
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-axios
|
||||
additionalProperties:
|
||||
stringEnums: true
|
@ -34,6 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|stringEnums|Generate string enums instead of objects for enum values.| |false|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |false|
|
||||
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|
||||
|
@ -34,8 +34,11 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
public static final String WITHOUT_PREFIX_ENUMS = "withoutPrefixEnums";
|
||||
public static final String USE_SINGLE_REQUEST_PARAMETER = "useSingleRequestParameter";
|
||||
public static final String WITH_NODE_IMPORTS = "withNodeImports";
|
||||
public static final String STRING_ENUMS = "stringEnums";
|
||||
public static final String STRING_ENUMS_DESC = "Generate string enums instead of objects for enum values.";
|
||||
|
||||
protected String npmRepository = null;
|
||||
protected Boolean stringEnums = false;
|
||||
|
||||
private String tsModelPackage = "";
|
||||
|
||||
@ -57,6 +60,7 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
this.cliOptions.add(new CliOption(WITHOUT_PREFIX_ENUMS, "Don't prefix enum names with class names", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(USE_SINGLE_REQUEST_PARAMETER, "Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(WITH_NODE_IMPORTS, "Setting this property to true adds imports for NodeJS", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(STRING_ENUMS, STRING_ENUMS_DESC).defaultValue(String.valueOf(this.stringEnums)));
|
||||
// Templates have no mapping between formatted property names and original base names so use only "original" and remove this option
|
||||
removeOption(CodegenConstants.MODEL_PROPERTY_NAMING);
|
||||
}
|
||||
@ -127,6 +131,11 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
}
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(STRING_ENUMS)) {
|
||||
this.stringEnums = Boolean.parseBoolean(additionalProperties.get(STRING_ENUMS).toString());
|
||||
additionalProperties.put("stringEnums", this.stringEnums);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(NPM_NAME)) {
|
||||
addNpmPackageGeneration();
|
||||
}
|
||||
|
@ -8,16 +8,10 @@ export type {{classname}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last
|
||||
{{/isBoolean}}
|
||||
|
||||
{{^isBoolean}}
|
||||
export enum {{classname}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{#enumDescription}}
|
||||
/**
|
||||
* {{.}}
|
||||
*/
|
||||
{{/enumDescription}}
|
||||
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
{{^stringEnums}}
|
||||
{{>modelObjectEnum}}
|
||||
{{/stringEnums}}
|
||||
{{#stringEnums}}
|
||||
{{>modelStringEnum}}
|
||||
{{/stringEnums}}
|
||||
{{/isBoolean}}
|
||||
|
@ -23,6 +23,7 @@ export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{
|
||||
|
||||
{{#vars}}
|
||||
{{#isEnum}}
|
||||
{{#stringEnums}}
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
@ -39,6 +40,23 @@ export enum {{enumName}} {
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
{{/stringEnums}}
|
||||
{{^stringEnums}}
|
||||
export const {{enumName}} = {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{#enumDescription}}
|
||||
/**
|
||||
* {{.}}
|
||||
*/
|
||||
{{/enumDescription}}
|
||||
{{{name}}}: {{{value}}}{{^-last}},{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
} as const;
|
||||
|
||||
export type {{enumName}} = typeof {{enumName}}[keyof typeof {{enumName}}];
|
||||
{{/stringEnums}}
|
||||
{{/isEnum}}
|
||||
{{/vars}}
|
||||
{{/hasEnums}}
|
||||
|
14
modules/openapi-generator/src/main/resources/typescript-axios/modelObjectEnum.mustache
vendored
Normal file
14
modules/openapi-generator/src/main/resources/typescript-axios/modelObjectEnum.mustache
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
export const {{classname}} = {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{#enumDescription}}
|
||||
/**
|
||||
* {{.}}
|
||||
*/
|
||||
{{/enumDescription}}
|
||||
{{{name}}}: {{{value}}}{{^-last}},{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
} as const;
|
||||
|
||||
export type {{classname}} = typeof {{classname}}[keyof typeof {{classname}}];
|
12
modules/openapi-generator/src/main/resources/typescript-axios/modelStringEnum.mustache
vendored
Normal file
12
modules/openapi-generator/src/main/resources/typescript-axios/modelStringEnum.mustache
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
export enum {{classname}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{#enumDescription}}
|
||||
/**
|
||||
* {{.}}
|
||||
*/
|
||||
{{/enumDescription}}
|
||||
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
@ -79,16 +79,14 @@ export interface Dog {
|
||||
'breed'?: DogBreedEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum DogBreedEnum {
|
||||
Dingo = 'Dingo',
|
||||
Husky = 'Husky',
|
||||
Retriever = 'Retriever',
|
||||
Shepherd = 'Shepherd'
|
||||
}
|
||||
export const DogBreedEnum = {
|
||||
Dingo: 'Dingo',
|
||||
Husky: 'Husky',
|
||||
Retriever: 'Retriever',
|
||||
Shepherd: 'Shepherd'
|
||||
} as const;
|
||||
|
||||
export type DogBreedEnum = typeof DogBreedEnum[keyof typeof DogBreedEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@ -110,16 +108,14 @@ export interface DogAllOf {
|
||||
'breed'?: DogAllOfBreedEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum DogAllOfBreedEnum {
|
||||
Dingo = 'Dingo',
|
||||
Husky = 'Husky',
|
||||
Retriever = 'Retriever',
|
||||
Shepherd = 'Shepherd'
|
||||
}
|
||||
export const DogAllOfBreedEnum = {
|
||||
Dingo: 'Dingo',
|
||||
Husky: 'Husky',
|
||||
Retriever: 'Retriever',
|
||||
Shepherd: 'Shepherd'
|
||||
} as const;
|
||||
|
||||
export type DogAllOfBreedEnum = typeof DogAllOfBreedEnum[keyof typeof DogAllOfBreedEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@ -173,14 +169,12 @@ export interface PetByType {
|
||||
'hunts'?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum PetByTypePetTypeEnum {
|
||||
Cat = 'Cat',
|
||||
Dog = 'Dog'
|
||||
}
|
||||
export const PetByTypePetTypeEnum = {
|
||||
Cat: 'Cat',
|
||||
Dog: 'Dog'
|
||||
} as const;
|
||||
|
||||
export type PetByTypePetTypeEnum = typeof PetByTypePetTypeEnum[keyof typeof PetByTypePetTypeEnum];
|
||||
|
||||
|
||||
/**
|
||||
|
@ -109,15 +109,13 @@ export interface Order {
|
||||
'complete'?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum OrderStatusEnum {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OrderStatusEnum = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum];
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
@ -163,15 +161,13 @@ export interface Pet {
|
||||
'status'?: PetStatusEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum PetStatusEnum {
|
||||
Available = 'available',
|
||||
Pending = 'pending',
|
||||
Sold = 'sold'
|
||||
}
|
||||
export const PetStatusEnum = {
|
||||
Available: 'available',
|
||||
Pending: 'pending',
|
||||
Sold: 'sold'
|
||||
} as const;
|
||||
|
||||
export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum];
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
|
@ -109,15 +109,13 @@ export interface Order {
|
||||
'complete'?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum OrderStatusEnum {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OrderStatusEnum = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum];
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
@ -163,15 +161,13 @@ export interface Pet {
|
||||
'status'?: PetStatusEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum PetStatusEnum {
|
||||
Available = 'available',
|
||||
Pending = 'pending',
|
||||
Sold = 'sold'
|
||||
}
|
||||
export const PetStatusEnum = {
|
||||
Available: 'available',
|
||||
Pending: 'pending',
|
||||
Sold: 'sold'
|
||||
} as const;
|
||||
|
||||
export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum];
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
|
@ -362,13 +362,11 @@ export interface ChildCat extends ParentPet {
|
||||
'pet_type': ChildCatPetTypeEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum ChildCatPetTypeEnum {
|
||||
ChildCat = 'ChildCat'
|
||||
}
|
||||
export const ChildCatPetTypeEnum = {
|
||||
ChildCat: 'ChildCat'
|
||||
} as const;
|
||||
|
||||
export type ChildCatPetTypeEnum = typeof ChildCatPetTypeEnum[keyof typeof ChildCatPetTypeEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@ -390,13 +388,11 @@ export interface ChildCatAllOf {
|
||||
'pet_type'?: ChildCatAllOfPetTypeEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum ChildCatAllOfPetTypeEnum {
|
||||
ChildCat = 'ChildCat'
|
||||
}
|
||||
export const ChildCatAllOfPetTypeEnum = {
|
||||
ChildCat: 'ChildCat'
|
||||
} as const;
|
||||
|
||||
export type ChildCatAllOfPetTypeEnum = typeof ChildCatAllOfPetTypeEnum[keyof typeof ChildCatAllOfPetTypeEnum];
|
||||
|
||||
/**
|
||||
* Model for testing model with \"_class\" property
|
||||
@ -548,22 +544,18 @@ export interface EnumArrays {
|
||||
'array_enum'?: Array<EnumArraysArrayEnumEnum>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumArraysJustSymbolEnum {
|
||||
GreaterThanOrEqualTo = '>=',
|
||||
Dollar = '$'
|
||||
}
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumArraysArrayEnumEnum {
|
||||
Fish = 'fish',
|
||||
Crab = 'crab'
|
||||
}
|
||||
export const EnumArraysJustSymbolEnum = {
|
||||
GreaterThanOrEqualTo: '>=',
|
||||
Dollar: '$'
|
||||
} as const;
|
||||
|
||||
export type EnumArraysJustSymbolEnum = typeof EnumArraysJustSymbolEnum[keyof typeof EnumArraysJustSymbolEnum];
|
||||
export const EnumArraysArrayEnumEnum = {
|
||||
Fish: 'fish',
|
||||
Crab: 'crab'
|
||||
} as const;
|
||||
|
||||
export type EnumArraysArrayEnumEnum = typeof EnumArraysArrayEnumEnum[keyof typeof EnumArraysArrayEnumEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@ -571,11 +563,14 @@ export enum EnumArraysArrayEnumEnum {
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export enum EnumClass {
|
||||
Abc = '_abc',
|
||||
Efg = '-efg',
|
||||
Xyz = '(xyz)'
|
||||
}
|
||||
export const EnumClass = {
|
||||
Abc: '_abc',
|
||||
Efg: '-efg',
|
||||
Xyz: '(xyz)'
|
||||
} as const;
|
||||
|
||||
export type EnumClass = typeof EnumClass[keyof typeof EnumClass];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
@ -639,48 +634,38 @@ export interface EnumTest {
|
||||
'outerEnumIntegerDefaultValue'?: OuterEnumIntegerDefaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumTestEnumStringEnum {
|
||||
Upper = 'UPPER',
|
||||
Lower = 'lower',
|
||||
Empty = ''
|
||||
}
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumTestEnumStringRequiredEnum {
|
||||
Upper = 'UPPER',
|
||||
Lower = 'lower',
|
||||
Empty = ''
|
||||
}
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumTestEnumIntegerEnum {
|
||||
NUMBER_1 = 1,
|
||||
NUMBER_MINUS_1 = -1
|
||||
}
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumTestEnumIntegerOnlyEnum {
|
||||
NUMBER_2 = 2,
|
||||
NUMBER_MINUS_2 = -2
|
||||
}
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumTestEnumNumberEnum {
|
||||
NUMBER_1_DOT_1 = 1.1,
|
||||
NUMBER_MINUS_1_DOT_2 = -1.2
|
||||
}
|
||||
export const EnumTestEnumStringEnum = {
|
||||
Upper: 'UPPER',
|
||||
Lower: 'lower',
|
||||
Empty: ''
|
||||
} as const;
|
||||
|
||||
export type EnumTestEnumStringEnum = typeof EnumTestEnumStringEnum[keyof typeof EnumTestEnumStringEnum];
|
||||
export const EnumTestEnumStringRequiredEnum = {
|
||||
Upper: 'UPPER',
|
||||
Lower: 'lower',
|
||||
Empty: ''
|
||||
} as const;
|
||||
|
||||
export type EnumTestEnumStringRequiredEnum = typeof EnumTestEnumStringRequiredEnum[keyof typeof EnumTestEnumStringRequiredEnum];
|
||||
export const EnumTestEnumIntegerEnum = {
|
||||
NUMBER_1: 1,
|
||||
NUMBER_MINUS_1: -1
|
||||
} as const;
|
||||
|
||||
export type EnumTestEnumIntegerEnum = typeof EnumTestEnumIntegerEnum[keyof typeof EnumTestEnumIntegerEnum];
|
||||
export const EnumTestEnumIntegerOnlyEnum = {
|
||||
NUMBER_2: 2,
|
||||
NUMBER_MINUS_2: -2
|
||||
} as const;
|
||||
|
||||
export type EnumTestEnumIntegerOnlyEnum = typeof EnumTestEnumIntegerOnlyEnum[keyof typeof EnumTestEnumIntegerOnlyEnum];
|
||||
export const EnumTestEnumNumberEnum = {
|
||||
NUMBER_1_DOT_1: 1.1,
|
||||
NUMBER_MINUS_1_DOT_2: -1.2
|
||||
} as const;
|
||||
|
||||
export type EnumTestEnumNumberEnum = typeof EnumTestEnumNumberEnum[keyof typeof EnumTestEnumNumberEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1007,14 +992,12 @@ export interface MapTest {
|
||||
'indirect_map'?: { [key: string]: boolean; };
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum MapTestMapOfEnumStringEnum {
|
||||
Upper = 'UPPER',
|
||||
Lower = 'lower'
|
||||
}
|
||||
export const MapTestMapOfEnumStringEnum = {
|
||||
Upper: 'UPPER',
|
||||
Lower: 'lower'
|
||||
} as const;
|
||||
|
||||
export type MapTestMapOfEnumStringEnum = typeof MapTestMapOfEnumStringEnum[keyof typeof MapTestMapOfEnumStringEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1283,15 +1266,13 @@ export interface Order {
|
||||
'complete'?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum OrderStatusEnum {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OrderStatusEnum = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1324,11 +1305,14 @@ export interface OuterComposite {
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export enum OuterEnum {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OuterEnum = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OuterEnum = typeof OuterEnum[keyof typeof OuterEnum];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1336,11 +1320,14 @@ export enum OuterEnum {
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export enum OuterEnumDefaultValue {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OuterEnumDefaultValue = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OuterEnumDefaultValue = typeof OuterEnumDefaultValue[keyof typeof OuterEnumDefaultValue];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1348,11 +1335,14 @@ export enum OuterEnumDefaultValue {
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export enum OuterEnumInteger {
|
||||
NUMBER_0 = 0,
|
||||
NUMBER_1 = 1,
|
||||
NUMBER_2 = 2
|
||||
}
|
||||
export const OuterEnumInteger = {
|
||||
NUMBER_0: 0,
|
||||
NUMBER_1: 1,
|
||||
NUMBER_2: 2
|
||||
} as const;
|
||||
|
||||
export type OuterEnumInteger = typeof OuterEnumInteger[keyof typeof OuterEnumInteger];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1360,11 +1350,14 @@ export enum OuterEnumInteger {
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export enum OuterEnumIntegerDefaultValue {
|
||||
NUMBER_0 = 0,
|
||||
NUMBER_1 = 1,
|
||||
NUMBER_2 = 2
|
||||
}
|
||||
export const OuterEnumIntegerDefaultValue = {
|
||||
NUMBER_0: 0,
|
||||
NUMBER_1: 1,
|
||||
NUMBER_2: 2
|
||||
} as const;
|
||||
|
||||
export type OuterEnumIntegerDefaultValue = typeof OuterEnumIntegerDefaultValue[keyof typeof OuterEnumIntegerDefaultValue];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1417,15 +1410,13 @@ export interface Pet {
|
||||
'status'?: PetStatusEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum PetStatusEnum {
|
||||
Available = 'available',
|
||||
Pending = 'pending',
|
||||
Sold = 'sold'
|
||||
}
|
||||
export const PetStatusEnum = {
|
||||
Available: 'available',
|
||||
Pending: 'pending',
|
||||
Sold: 'sold'
|
||||
} as const;
|
||||
|
||||
export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum];
|
||||
|
||||
/**
|
||||
* @type Pig
|
||||
@ -1731,15 +1722,13 @@ export interface Zebra {
|
||||
'className': string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum ZebraTypeEnum {
|
||||
Plains = 'plains',
|
||||
Mountain = 'mountain',
|
||||
Grevys = 'grevys'
|
||||
}
|
||||
export const ZebraTypeEnum = {
|
||||
Plains: 'plains',
|
||||
Mountain: 'mountain',
|
||||
Grevys: 'grevys'
|
||||
} as const;
|
||||
|
||||
export type ZebraTypeEnum = typeof ZebraTypeEnum[keyof typeof ZebraTypeEnum];
|
||||
|
||||
|
||||
/**
|
||||
|
@ -109,15 +109,13 @@ export interface Order {
|
||||
'complete'?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum OrderStatusEnum {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OrderStatusEnum = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum];
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
@ -163,15 +161,13 @@ export interface Pet {
|
||||
'status'?: PetStatusEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum PetStatusEnum {
|
||||
Available = 'available',
|
||||
Pending = 'pending',
|
||||
Sold = 'sold'
|
||||
}
|
||||
export const PetStatusEnum = {
|
||||
Available: 'available',
|
||||
Pending: 'pending',
|
||||
Sold: 'sold'
|
||||
} as const;
|
||||
|
||||
export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum];
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
|
@ -361,22 +361,18 @@ export interface EnumArrays {
|
||||
'array_enum'?: Array<EnumArraysArrayEnumEnum>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumArraysJustSymbolEnum {
|
||||
GreaterThanOrEqualTo = '>=',
|
||||
Dollar = '$'
|
||||
}
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumArraysArrayEnumEnum {
|
||||
Fish = 'fish',
|
||||
Crab = 'crab'
|
||||
}
|
||||
export const EnumArraysJustSymbolEnum = {
|
||||
GreaterThanOrEqualTo: '>=',
|
||||
Dollar: '$'
|
||||
} as const;
|
||||
|
||||
export type EnumArraysJustSymbolEnum = typeof EnumArraysJustSymbolEnum[keyof typeof EnumArraysJustSymbolEnum];
|
||||
export const EnumArraysArrayEnumEnum = {
|
||||
Fish: 'fish',
|
||||
Crab: 'crab'
|
||||
} as const;
|
||||
|
||||
export type EnumArraysArrayEnumEnum = typeof EnumArraysArrayEnumEnum[keyof typeof EnumArraysArrayEnumEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@ -384,11 +380,14 @@ export enum EnumArraysArrayEnumEnum {
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export enum EnumClass {
|
||||
Abc = '_abc',
|
||||
Efg = '-efg',
|
||||
Xyz = '(xyz)'
|
||||
}
|
||||
export const EnumClass = {
|
||||
Abc: '_abc',
|
||||
Efg: '-efg',
|
||||
Xyz: '(xyz)'
|
||||
} as const;
|
||||
|
||||
export type EnumClass = typeof EnumClass[keyof typeof EnumClass];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
@ -446,40 +445,32 @@ export interface EnumTest {
|
||||
'outerEnumIntegerDefaultValue'?: OuterEnumIntegerDefaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumTestEnumStringEnum {
|
||||
Upper = 'UPPER',
|
||||
Lower = 'lower',
|
||||
Empty = ''
|
||||
}
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumTestEnumStringRequiredEnum {
|
||||
Upper = 'UPPER',
|
||||
Lower = 'lower',
|
||||
Empty = ''
|
||||
}
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumTestEnumIntegerEnum {
|
||||
NUMBER_1 = 1,
|
||||
NUMBER_MINUS_1 = -1
|
||||
}
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum EnumTestEnumNumberEnum {
|
||||
NUMBER_1_DOT_1 = 1.1,
|
||||
NUMBER_MINUS_1_DOT_2 = -1.2
|
||||
}
|
||||
export const EnumTestEnumStringEnum = {
|
||||
Upper: 'UPPER',
|
||||
Lower: 'lower',
|
||||
Empty: ''
|
||||
} as const;
|
||||
|
||||
export type EnumTestEnumStringEnum = typeof EnumTestEnumStringEnum[keyof typeof EnumTestEnumStringEnum];
|
||||
export const EnumTestEnumStringRequiredEnum = {
|
||||
Upper: 'UPPER',
|
||||
Lower: 'lower',
|
||||
Empty: ''
|
||||
} as const;
|
||||
|
||||
export type EnumTestEnumStringRequiredEnum = typeof EnumTestEnumStringRequiredEnum[keyof typeof EnumTestEnumStringRequiredEnum];
|
||||
export const EnumTestEnumIntegerEnum = {
|
||||
NUMBER_1: 1,
|
||||
NUMBER_MINUS_1: -1
|
||||
} as const;
|
||||
|
||||
export type EnumTestEnumIntegerEnum = typeof EnumTestEnumIntegerEnum[keyof typeof EnumTestEnumIntegerEnum];
|
||||
export const EnumTestEnumNumberEnum = {
|
||||
NUMBER_1_DOT_1: 1.1,
|
||||
NUMBER_MINUS_1_DOT_2: -1.2
|
||||
} as const;
|
||||
|
||||
export type EnumTestEnumNumberEnum = typeof EnumTestEnumNumberEnum[keyof typeof EnumTestEnumNumberEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@ -743,14 +734,12 @@ export interface MapTest {
|
||||
'indirect_map'?: { [key: string]: boolean; };
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum MapTestMapOfEnumStringEnum {
|
||||
Upper = 'UPPER',
|
||||
Lower = 'lower'
|
||||
}
|
||||
export const MapTestMapOfEnumStringEnum = {
|
||||
Upper: 'UPPER',
|
||||
Lower: 'lower'
|
||||
} as const;
|
||||
|
||||
export type MapTestMapOfEnumStringEnum = typeof MapTestMapOfEnumStringEnum[keyof typeof MapTestMapOfEnumStringEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@ -978,15 +967,13 @@ export interface Order {
|
||||
'complete'?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum OrderStatusEnum {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OrderStatusEnum = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1019,11 +1006,14 @@ export interface OuterComposite {
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export enum OuterEnum {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OuterEnum = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OuterEnum = typeof OuterEnum[keyof typeof OuterEnum];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1031,11 +1021,14 @@ export enum OuterEnum {
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export enum OuterEnumDefaultValue {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OuterEnumDefaultValue = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OuterEnumDefaultValue = typeof OuterEnumDefaultValue[keyof typeof OuterEnumDefaultValue];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1043,11 +1036,14 @@ export enum OuterEnumDefaultValue {
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export enum OuterEnumInteger {
|
||||
NUMBER_0 = 0,
|
||||
NUMBER_1 = 1,
|
||||
NUMBER_2 = 2
|
||||
}
|
||||
export const OuterEnumInteger = {
|
||||
NUMBER_0: 0,
|
||||
NUMBER_1: 1,
|
||||
NUMBER_2: 2
|
||||
} as const;
|
||||
|
||||
export type OuterEnumInteger = typeof OuterEnumInteger[keyof typeof OuterEnumInteger];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1055,11 +1051,14 @@ export enum OuterEnumInteger {
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export enum OuterEnumIntegerDefaultValue {
|
||||
NUMBER_0 = 0,
|
||||
NUMBER_1 = 1,
|
||||
NUMBER_2 = 2
|
||||
}
|
||||
export const OuterEnumIntegerDefaultValue = {
|
||||
NUMBER_0: 0,
|
||||
NUMBER_1: 1,
|
||||
NUMBER_2: 2
|
||||
} as const;
|
||||
|
||||
export type OuterEnumIntegerDefaultValue = typeof OuterEnumIntegerDefaultValue[keyof typeof OuterEnumIntegerDefaultValue];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1106,15 +1105,13 @@ export interface Pet {
|
||||
'status'?: PetStatusEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum PetStatusEnum {
|
||||
Available = 'available',
|
||||
Pending = 'pending',
|
||||
Sold = 'sold'
|
||||
}
|
||||
export const PetStatusEnum = {
|
||||
Available: 'available',
|
||||
Pending: 'pending',
|
||||
Sold: 'sold'
|
||||
} as const;
|
||||
|
||||
export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1353,15 +1350,13 @@ export interface Zebra {
|
||||
'className': string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum ZebraTypeEnum {
|
||||
Plains = 'plains',
|
||||
Mountain = 'mountain',
|
||||
Grevys = 'grevys'
|
||||
}
|
||||
export const ZebraTypeEnum = {
|
||||
Plains: 'plains',
|
||||
Mountain: 'mountain',
|
||||
Grevys: 'grevys'
|
||||
} as const;
|
||||
|
||||
export type ZebraTypeEnum = typeof ZebraTypeEnum[keyof typeof ZebraTypeEnum];
|
||||
|
||||
|
||||
/**
|
||||
|
@ -109,15 +109,13 @@ export interface Order {
|
||||
'complete'?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum OrderStatusEnum {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OrderStatusEnum = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum];
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
@ -163,15 +161,13 @@ export interface Pet {
|
||||
'status'?: PetStatusEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum PetStatusEnum {
|
||||
Available = 'available',
|
||||
Pending = 'pending',
|
||||
Sold = 'sold'
|
||||
}
|
||||
export const PetStatusEnum = {
|
||||
Available: 'available',
|
||||
Pending: 'pending',
|
||||
Sold: 'sold'
|
||||
} as const;
|
||||
|
||||
export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum];
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
|
@ -113,15 +113,13 @@ export interface Order {
|
||||
'complete'?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum OrderStatusEnum {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OrderStatusEnum = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum];
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
@ -167,15 +165,13 @@ export interface Pet {
|
||||
'status'?: PetStatusEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum PetStatusEnum {
|
||||
Available = 'available',
|
||||
Pending = 'pending',
|
||||
Sold = 'sold'
|
||||
}
|
||||
export const PetStatusEnum = {
|
||||
Available: 'available',
|
||||
Pending: 'pending',
|
||||
Sold: 'sold'
|
||||
} as const;
|
||||
|
||||
export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum];
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
|
@ -58,14 +58,12 @@ export interface Order {
|
||||
'complete'?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum OrderStatusEnum {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OrderStatusEnum = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum];
|
||||
|
||||
|
||||
|
@ -60,14 +60,12 @@ export interface Pet {
|
||||
'status'?: PetStatusEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum PetStatusEnum {
|
||||
Available = 'available',
|
||||
Pending = 'pending',
|
||||
Sold = 'sold'
|
||||
}
|
||||
export const PetStatusEnum = {
|
||||
Available: 'available',
|
||||
Pending: 'pending',
|
||||
Sold: 'sold'
|
||||
} as const;
|
||||
|
||||
export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum];
|
||||
|
||||
|
||||
|
@ -109,15 +109,13 @@ export interface Order {
|
||||
'complete'?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum OrderStatusEnum {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OrderStatusEnum = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum];
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
@ -163,15 +161,13 @@ export interface Pet {
|
||||
'status'?: PetStatusEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum PetStatusEnum {
|
||||
Available = 'available',
|
||||
Pending = 'pending',
|
||||
Sold = 'sold'
|
||||
}
|
||||
export const PetStatusEnum = {
|
||||
Available: 'available',
|
||||
Pending: 'pending',
|
||||
Sold: 'sold'
|
||||
} as const;
|
||||
|
||||
export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum];
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
|
@ -109,15 +109,13 @@ export interface Order {
|
||||
'complete'?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum OrderStatusEnum {
|
||||
Placed = 'placed',
|
||||
Approved = 'approved',
|
||||
Delivered = 'delivered'
|
||||
}
|
||||
export const OrderStatusEnum = {
|
||||
Placed: 'placed',
|
||||
Approved: 'approved',
|
||||
Delivered: 'delivered'
|
||||
} as const;
|
||||
|
||||
export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum];
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
@ -163,15 +161,13 @@ export interface Pet {
|
||||
'status'?: PetStatusEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum PetStatusEnum {
|
||||
Available = 'available',
|
||||
Pending = 'pending',
|
||||
Sold = 'sold'
|
||||
}
|
||||
export const PetStatusEnum = {
|
||||
Available: 'available',
|
||||
Pending: 'pending',
|
||||
Sold: 'sold'
|
||||
} as const;
|
||||
|
||||
export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum];
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
|
4
samples/client/petstore/typescript-axios/builds/with-string-enums/.gitignore
vendored
Normal file
4
samples/client/petstore/typescript-axios/builds/with-string-enums/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
wwwroot/*.js
|
||||
node_modules
|
||||
typings
|
||||
dist
|
@ -0,0 +1 @@
|
||||
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
|
@ -0,0 +1,23 @@
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
@ -0,0 +1,8 @@
|
||||
.gitignore
|
||||
.npmignore
|
||||
api.ts
|
||||
base.ts
|
||||
common.ts
|
||||
configuration.ts
|
||||
git_push.sh
|
||||
index.ts
|
@ -0,0 +1 @@
|
||||
5.4.0-SNAPSHOT
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,71 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
// Some imports not used depending on template conditions
|
||||
// @ts-ignore
|
||||
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
||||
|
||||
export const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const COLLECTION_FORMATS = {
|
||||
csv: ",",
|
||||
ssv: " ",
|
||||
tsv: "\t",
|
||||
pipes: "|",
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface RequestArgs
|
||||
*/
|
||||
export interface RequestArgs {
|
||||
url: string;
|
||||
options: AxiosRequestConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class BaseAPI
|
||||
*/
|
||||
export class BaseAPI {
|
||||
protected configuration: Configuration | undefined;
|
||||
|
||||
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = configuration.basePath || this.basePath;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class RequiredError
|
||||
* @extends {Error}
|
||||
*/
|
||||
export class RequiredError extends Error {
|
||||
name: "RequiredError" = "RequiredError";
|
||||
constructor(public field: string, msg?: string) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const DUMMY_BASE_URL = 'https://example.com'
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws {RequiredError}
|
||||
* @export
|
||||
*/
|
||||
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||
if (paramValue === null || paramValue === undefined) {
|
||||
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||
if (configuration && configuration.apiKey) {
|
||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||
? await configuration.apiKey(keyParamName)
|
||||
: await configuration.apiKey;
|
||||
object[keyParamName] = localVarApiKeyValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||
if (configuration && (configuration.username || configuration.password)) {
|
||||
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||
if (configuration && configuration.accessToken) {
|
||||
const accessToken = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken()
|
||||
: await configuration.accessToken;
|
||||
object["Authorization"] = "Bearer " + accessToken;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken(name, scopes)
|
||||
: await configuration.accessToken;
|
||||
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||
const searchParams = new URLSearchParams(url.search);
|
||||
for (const object of objects) {
|
||||
for (const key in object) {
|
||||
if (Array.isArray(object[key])) {
|
||||
searchParams.delete(key);
|
||||
for (const item of object[key]) {
|
||||
searchParams.append(key, item);
|
||||
}
|
||||
} else {
|
||||
searchParams.set(key, object[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
url.search = searchParams.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||
const nonString = typeof value !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
return needsSerialization
|
||||
? JSON.stringify(value !== undefined ? value : {})
|
||||
: (value || "");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const toPathString = function (url: URL) {
|
||||
return url.pathname + url.search + url.hash
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface ConfigurationParameters {
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
username?: string;
|
||||
password?: string;
|
||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
basePath?: string;
|
||||
baseOptions?: any;
|
||||
formDataCtor?: new () => any;
|
||||
}
|
||||
|
||||
export class Configuration {
|
||||
/**
|
||||
* parameter for apiKey security
|
||||
* @param name security name
|
||||
* @memberof Configuration
|
||||
*/
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
/**
|
||||
* parameter for basic security
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
* parameter for basic security
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
password?: string;
|
||||
/**
|
||||
* parameter for oauth2 security
|
||||
* @param name security name
|
||||
* @param scopes oauth2 scope
|
||||
* @memberof Configuration
|
||||
*/
|
||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePath?: string;
|
||||
/**
|
||||
* base options for axios calls
|
||||
*
|
||||
* @type {any}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
baseOptions?: any;
|
||||
/**
|
||||
* The FormData constructor that will be used to create multipart form data
|
||||
* requests. You can inject this here so that execution environments that
|
||||
* do not support the FormData class can still run the generated client.
|
||||
*
|
||||
* @type {new () => FormData}
|
||||
*/
|
||||
formDataCtor?: new () => any;
|
||||
|
||||
constructor(param: ConfigurationParameters = {}) {
|
||||
this.apiKey = param.apiKey;
|
||||
this.username = param.username;
|
||||
this.password = param.password;
|
||||
this.accessToken = param.accessToken;
|
||||
this.basePath = param.basePath;
|
||||
this.baseOptions = param.baseOptions;
|
||||
this.formDataCtor = param.formDataCtor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
git_host=$4
|
||||
|
||||
if [ "$git_host" = "" ]; then
|
||||
git_host="github.com"
|
||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||
fi
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=$(git remote)
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
@ -0,0 +1,18 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export * from "./api";
|
||||
export * from "./configuration";
|
||||
|
Loading…
x
Reference in New Issue
Block a user