Skip to content

Commit 07b1502

Browse files
committed
update samples
1 parent 1da5d35 commit 07b1502

6 files changed

Lines changed: 132 additions & 6 deletions

File tree

samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Category.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,26 @@ export interface Category {
3232
*/
3333
name?: string;
3434
}
35+
export const CategoryPropertyValidationAttributesMap: {
36+
[property: string]: {
37+
maxLength?: number,
38+
minLength?: number,
39+
pattern?: string,
40+
maximum?: number,
41+
exclusiveMaximum?: boolean,
42+
minimum?: number,
43+
exclusiveMinimum?: boolean,
44+
multipleOf?: number,
45+
maxItems?: number,
46+
minItems?: number,
47+
uniqueItems?: boolean
48+
}
49+
} = {
50+
name: {
51+
pattern: '/^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$/',
52+
},
53+
}
54+
3555

3656
/**
3757
* Check if a given object implements the Category interface.
@@ -70,7 +90,6 @@ export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator
7090
'name': value['name'],
7191
};
7292
}
73-
7493
export const CategoryPropertyValidationAttributesMap: {
7594
[property: string]: {
7695
maxLength?: number,
@@ -91,3 +110,4 @@ export const CategoryPropertyValidationAttributesMap: {
91110
},
92111
}
93112

113+

samples/client/petstore/typescript-fetch/builds/validation-attributes/models/ModelApiResponse.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,23 @@ export interface ModelApiResponse {
3838
*/
3939
message?: string;
4040
}
41+
export const ModelApiResponsePropertyValidationAttributesMap: {
42+
[property: string]: {
43+
maxLength?: number,
44+
minLength?: number,
45+
pattern?: string,
46+
maximum?: number,
47+
exclusiveMaximum?: boolean,
48+
minimum?: number,
49+
exclusiveMinimum?: boolean,
50+
multipleOf?: number,
51+
maxItems?: number,
52+
minItems?: number,
53+
uniqueItems?: boolean
54+
}
55+
} = {
56+
}
57+
4158

4259
/**
4360
* Check if a given object implements the ModelApiResponse interface.
@@ -78,7 +95,6 @@ export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ign
7895
'message': value['message'],
7996
};
8097
}
81-
8298
export const ModelApiResponsePropertyValidationAttributesMap: {
8399
[property: string]: {
84100
maxLength?: number,
@@ -96,3 +112,4 @@ export const ModelApiResponsePropertyValidationAttributesMap: {
96112
} = {
97113
}
98114

115+

samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Order.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,28 @@ export const OrderStatusEnum = {
6969
} as const;
7070
export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum];
7171

72+
export const OrderPropertyValidationAttributesMap: {
73+
[property: string]: {
74+
maxLength?: number,
75+
minLength?: number,
76+
pattern?: string,
77+
maximum?: number,
78+
exclusiveMaximum?: boolean,
79+
minimum?: number,
80+
exclusiveMinimum?: boolean,
81+
multipleOf?: number,
82+
maxItems?: number,
83+
minItems?: number,
84+
uniqueItems?: boolean
85+
}
86+
} = {
87+
}
88+
89+
export const OrderAdditionalPropertiesValidationAttributes: { maxProperties?: number, minProperties?: number } = {
90+
maxProperties: 10,
91+
minProperties: 2,
92+
}
93+
7294

7395
/**
7496
* Check if a given object implements the Order interface.
@@ -117,7 +139,6 @@ export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: bool
117139
'complete': value['complete'],
118140
};
119141
}
120-
121142
export const OrderPropertyValidationAttributesMap: {
122143
[property: string]: {
123144
maxLength?: number,
@@ -140,3 +161,4 @@ export const OrderAdditionalPropertiesValidationAttributes: { maxProperties?: nu
140161
minProperties: 2,
141162
}
142163

164+

samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Pet.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,28 @@ export const PetStatusEnum = {
8484
} as const;
8585
export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum];
8686

87+
export const PetPropertyValidationAttributesMap: {
88+
[property: string]: {
89+
maxLength?: number,
90+
minLength?: number,
91+
pattern?: string,
92+
maximum?: number,
93+
exclusiveMaximum?: boolean,
94+
minimum?: number,
95+
exclusiveMinimum?: boolean,
96+
multipleOf?: number,
97+
maxItems?: number,
98+
minItems?: number,
99+
uniqueItems?: boolean
100+
}
101+
} = {
102+
photoUrls: {
103+
maxItems: 8,
104+
minItems: 1,
105+
uniqueItems: true,
106+
},
107+
}
108+
87109

88110
/**
89111
* Check if a given object implements the Pet interface.
@@ -132,7 +154,6 @@ export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean
132154
'status': value['status'],
133155
};
134156
}
135-
136157
export const PetPropertyValidationAttributesMap: {
137158
[property: string]: {
138159
maxLength?: number,
@@ -155,3 +176,4 @@ export const PetPropertyValidationAttributesMap: {
155176
},
156177
}
157178

179+

samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Tag.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,23 @@ export interface Tag {
3232
*/
3333
name?: string;
3434
}
35+
export const TagPropertyValidationAttributesMap: {
36+
[property: string]: {
37+
maxLength?: number,
38+
minLength?: number,
39+
pattern?: string,
40+
maximum?: number,
41+
exclusiveMaximum?: boolean,
42+
minimum?: number,
43+
exclusiveMinimum?: boolean,
44+
multipleOf?: number,
45+
maxItems?: number,
46+
minItems?: number,
47+
uniqueItems?: boolean
48+
}
49+
} = {
50+
}
51+
3552

3653
/**
3754
* Check if a given object implements the Tag interface.
@@ -70,7 +87,6 @@ export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean
7087
'name': value['name'],
7188
};
7289
}
73-
7490
export const TagPropertyValidationAttributesMap: {
7591
[property: string]: {
7692
maxLength?: number,
@@ -88,3 +104,4 @@ export const TagPropertyValidationAttributesMap: {
88104
} = {
89105
}
90106

107+

samples/client/petstore/typescript-fetch/builds/validation-attributes/models/User.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,34 @@ export interface User {
6868
*/
6969
userStatus?: number;
7070
}
71+
export const UserPropertyValidationAttributesMap: {
72+
[property: string]: {
73+
maxLength?: number,
74+
minLength?: number,
75+
pattern?: string,
76+
maximum?: number,
77+
exclusiveMaximum?: boolean,
78+
minimum?: number,
79+
exclusiveMinimum?: boolean,
80+
multipleOf?: number,
81+
maxItems?: number,
82+
minItems?: number,
83+
uniqueItems?: boolean
84+
}
85+
} = {
86+
password: {
87+
maxLength: 256,
88+
minLength: 8,
89+
},
90+
userStatus: {
91+
maximum: 100,
92+
exclusiveMaximum: true,
93+
minimum: 0,
94+
exclusiveMinimum: true,
95+
multipleOf: 10,
96+
},
97+
}
98+
7199

72100
/**
73101
* Check if a given object implements the User interface.
@@ -118,7 +146,6 @@ export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolea
118146
'userStatus': value['userStatus'],
119147
};
120148
}
121-
122149
export const UserPropertyValidationAttributesMap: {
123150
[property: string]: {
124151
maxLength?: number,
@@ -147,3 +174,4 @@ export const UserPropertyValidationAttributesMap: {
147174
},
148175
}
149176

177+

0 commit comments

Comments
 (0)