tangled
alpha
login
or
join now
mokkenstorm.dev
/
openapi-ts
0
fork
atom
fork of hey-api/openapi-ts because I need some additional things
0
fork
atom
overview
issues
pulls
pipelines
chore: use exported data types
Lubos
1 year ago
715d5a81
255c4280
+282
-887
7 changed files
expand all
collapse all
unified
split
packages
openapi-ts
src
ir
parameter.ts
schema.ts
plugins
@hey-api
types
plugin.ts
fastify
config.ts
plugin.ts
test
__snapshots__
3.0.x
plugins
fastify
default
fastify.gen.ts
3.1.x
plugins
fastify
default
fastify.gen.ts
+21
-17
packages/openapi-ts/src/ir/parameter.ts
···
1
1
-
import type { IRParametersObject } from './ir';
1
1
+
import type { IRParameterObject, IRParametersObject } from './ir';
2
2
import type { Pagination } from './pagination';
3
3
4
4
+
export const hasParameterGroupObjectRequired = (
5
5
+
parameterGroup?: Record<string, IRParameterObject>,
6
6
+
): boolean => {
7
7
+
for (const name in parameterGroup) {
8
8
+
if (parameterGroup[name].required) {
9
9
+
return true;
10
10
+
}
11
11
+
}
12
12
+
13
13
+
return false;
14
14
+
};
15
15
+
4
16
export const hasParametersObjectRequired = (
5
17
parameters: IRParametersObject | undefined,
6
18
): boolean => {
···
8
20
return false;
9
21
}
10
22
11
11
-
for (const name in parameters.cookie) {
12
12
-
if (parameters.cookie[name].required) {
13
13
-
return true;
14
14
-
}
23
23
+
if (hasParameterGroupObjectRequired(parameters.cookie)) {
24
24
+
return true;
15
25
}
16
26
17
17
-
for (const name in parameters.header) {
18
18
-
if (parameters.header[name].required) {
19
19
-
return true;
20
20
-
}
27
27
+
if (hasParameterGroupObjectRequired(parameters.header)) {
28
28
+
return true;
21
29
}
22
30
23
23
-
for (const name in parameters.path) {
24
24
-
if (parameters.path[name].required) {
25
25
-
return true;
26
26
-
}
31
31
+
if (hasParameterGroupObjectRequired(parameters.path)) {
32
32
+
return true;
27
33
}
28
34
29
29
-
for (const name in parameters.query) {
30
30
-
if (parameters.query[name].required) {
31
31
-
return true;
32
32
-
}
35
35
+
if (hasParameterGroupObjectRequired(parameters.query)) {
36
36
+
return true;
33
37
}
34
38
35
39
return false;
+1
-34
packages/openapi-ts/src/ir/schema.ts
···
1
1
-
import type { IRParameterObject, IRSchemaObject } from './ir';
1
1
+
import type { IRSchemaObject } from './ir';
2
2
3
3
/**
4
4
* Ensure we don't produce redundant types, e.g. string | string.
···
70
70
71
71
return schema;
72
72
};
73
73
-
74
74
-
export const irParametersToIrSchema = ({
75
75
-
parameters,
76
76
-
}: {
77
77
-
parameters: Record<string, IRParameterObject>;
78
78
-
}): IRSchemaObject => {
79
79
-
const irSchema: IRSchemaObject = {
80
80
-
type: 'object',
81
81
-
};
82
82
-
83
83
-
const properties: Record<string, IRSchemaObject> = {};
84
84
-
const required: Array<string> = [];
85
85
-
86
86
-
for (const name in parameters) {
87
87
-
const parameter = parameters[name];
88
88
-
89
89
-
properties[name] = deduplicateSchema({
90
90
-
schema: parameter.schema,
91
91
-
});
92
92
-
93
93
-
if (parameter.required) {
94
94
-
required.push(name);
95
95
-
}
96
96
-
}
97
97
-
98
98
-
irSchema.properties = properties;
99
99
-
100
100
-
if (required.length) {
101
101
-
irSchema.required = required;
102
102
-
}
103
103
-
104
104
-
return irSchema;
105
105
-
};
+37
-1
packages/openapi-ts/src/plugins/@hey-api/types/plugin.ts
···
2
2
import type { IRContext } from '../../../ir/context';
3
3
import type {
4
4
IROperationObject,
5
5
+
IRParameterObject,
5
6
IRPathItemObject,
6
7
IRPathsObject,
7
8
IRSchemaObject,
8
9
} from '../../../ir/ir';
9
10
import { operationResponsesMap } from '../../../ir/operation';
10
10
-
import { irParametersToIrSchema } from '../../../ir/schema';
11
11
+
import { deduplicateSchema } from '../../../ir/schema';
11
12
import type { PluginHandler } from '../../types';
12
13
import {
13
14
componentsToType,
···
22
23
import type { Config } from './types';
23
24
24
25
export const typesId = 'types';
26
26
+
27
27
+
const irParametersToIrSchema = ({
28
28
+
parameters,
29
29
+
}: {
30
30
+
parameters: Record<string, IRParameterObject>;
31
31
+
}): IRSchemaObject => {
32
32
+
const irSchema: IRSchemaObject = {
33
33
+
type: 'object',
34
34
+
};
35
35
+
36
36
+
if (parameters) {
37
37
+
const properties: Record<string, IRSchemaObject> = {};
38
38
+
const required: Array<string> = [];
39
39
+
40
40
+
for (const name in parameters) {
41
41
+
const parameter = parameters[name];
42
42
+
43
43
+
properties[name] = deduplicateSchema({
44
44
+
schema: parameter.schema,
45
45
+
});
46
46
+
47
47
+
if (parameter.required) {
48
48
+
required.push(name);
49
49
+
}
50
50
+
}
51
51
+
52
52
+
irSchema.properties = properties;
53
53
+
54
54
+
if (required.length) {
55
55
+
irSchema.required = required;
56
56
+
}
57
57
+
}
58
58
+
59
59
+
return irSchema;
60
60
+
};
25
61
26
62
const operationToDataType = ({
27
63
context,
+1
-1
packages/openapi-ts/src/plugins/fastify/config.ts
···
3
3
import type { Config } from './types';
4
4
5
5
export const defaultConfig: PluginConfig<Config> = {
6
6
-
_dependencies: ['@hey-api/services'],
6
6
+
_dependencies: ['@hey-api/types', '@hey-api/services'],
7
7
_handler: handler,
8
8
_handlerLegacy: () => {},
9
9
name: 'fastify',
+60
-46
packages/openapi-ts/src/plugins/fastify/plugin.ts
···
5
5
IRPathItemObject,
6
6
IRPathsObject,
7
7
} from '../../ir/ir';
8
8
-
import { irParametersToIrSchema } from '../../ir/schema';
8
8
+
import { hasParameterGroupObjectRequired } from '../../ir/parameter';
9
9
+
import { operationDataRef } from '../@hey-api/services/plugin';
9
10
import type { PluginHandler } from '../types';
10
11
import { componentsToType, schemaToType } from '../utils/types';
11
12
import type { Config } from './types';
···
23
24
24
25
const properties: Array<Property> = [];
25
26
26
26
-
if (operation.body) {
27
27
-
properties.push({
28
28
-
isRequired: operation.body.required,
29
29
-
name: 'Body',
30
30
-
type: schemaToType({
31
31
-
options: { file },
32
32
-
schema: operation.body.schema,
33
33
-
}),
34
34
-
});
35
35
-
}
27
27
+
const identifierData = context.file({ id: 'types' })!.identifier({
28
28
+
$ref: operationDataRef({ id: operation.id }),
29
29
+
namespace: 'type',
30
30
+
});
36
31
37
37
-
if (operation.parameters) {
38
38
-
if (operation.parameters.header) {
39
39
-
const schema = irParametersToIrSchema({
40
40
-
parameters: operation.parameters.header,
32
32
+
if (identifierData.name) {
33
33
+
if (operation.body) {
34
34
+
file.import({
35
35
+
asType: true,
36
36
+
module: file.relativePathToFile({ context, id: 'types' }),
37
37
+
name: identifierData.name,
41
38
});
42
39
properties.push({
43
43
-
isRequired: Boolean(schema.required),
44
44
-
name: 'Headers',
45
45
-
type: schemaToType({
46
46
-
options: { file },
47
47
-
schema,
48
48
-
}),
40
40
+
isRequired: operation.body.required,
41
41
+
name: 'Body',
42
42
+
type: `${identifierData.name}['body']`,
49
43
});
50
44
}
51
45
52
52
-
if (operation.parameters.path) {
53
53
-
const schema = irParametersToIrSchema({
54
54
-
parameters: operation.parameters.path,
55
55
-
});
56
56
-
properties.push({
57
57
-
isRequired: Boolean(schema.required),
58
58
-
name: 'Params',
59
59
-
type: schemaToType({
60
60
-
options: { file },
61
61
-
schema,
62
62
-
}),
63
63
-
});
64
64
-
}
46
46
+
if (operation.parameters) {
47
47
+
if (operation.parameters.header) {
48
48
+
file.import({
49
49
+
asType: true,
50
50
+
module: file.relativePathToFile({ context, id: 'types' }),
51
51
+
name: identifierData.name,
52
52
+
});
53
53
+
properties.push({
54
54
+
isRequired: hasParameterGroupObjectRequired(
55
55
+
operation.parameters.header,
56
56
+
),
57
57
+
name: 'Headers',
58
58
+
type: `${identifierData.name}['headers']`,
59
59
+
});
60
60
+
}
65
61
66
66
-
if (operation.parameters.query) {
67
67
-
const schema = irParametersToIrSchema({
68
68
-
parameters: operation.parameters.query,
69
69
-
});
70
70
-
properties.push({
71
71
-
isRequired: Boolean(schema.required),
72
72
-
name: 'Querystring',
73
73
-
type: schemaToType({
74
74
-
options: { file },
75
75
-
schema,
76
76
-
}),
77
77
-
});
62
62
+
if (operation.parameters.path) {
63
63
+
file.import({
64
64
+
asType: true,
65
65
+
module: file.relativePathToFile({ context, id: 'types' }),
66
66
+
name: identifierData.name,
67
67
+
});
68
68
+
properties.push({
69
69
+
isRequired: hasParameterGroupObjectRequired(
70
70
+
operation.parameters.path,
71
71
+
),
72
72
+
name: 'Params',
73
73
+
type: `${identifierData.name}['path']`,
74
74
+
});
75
75
+
}
76
76
+
77
77
+
if (operation.parameters.query) {
78
78
+
file.import({
79
79
+
asType: true,
80
80
+
module: file.relativePathToFile({ context, id: 'types' }),
81
81
+
name: identifierData.name,
82
82
+
});
83
83
+
properties.push({
84
84
+
isRequired: hasParameterGroupObjectRequired(
85
85
+
operation.parameters.query,
86
86
+
),
87
87
+
name: 'Querystring',
88
88
+
type: `${identifierData.name}['query']`,
89
89
+
});
90
90
+
}
78
91
}
79
92
}
80
93
···
87
100
}
88
101
89
102
const response = operation.responses[code]!;
103
103
+
// TODO: numeric literal for numbers
90
104
responseProperties.push({
91
105
name: code,
92
106
type: schemaToType({
+81
-394
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/fastify/default/fastify.gen.ts
···
1
1
// This file is auto-generated by @hey-api/openapi-ts
2
2
3
3
import type { RouteHandler } from 'fastify';
4
4
+
import type { ImportData, GetApiVbyApiVersionSimpleOperationData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CollectionFormatData, TypesData, UploadFileData, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, PutWithFormUrlEncodedData } from './types.gen';
4
5
5
6
/**
6
7
* Model with number-only name
···
948
949
export type RouteHandlers = {
949
950
export: RouteHandler<{}>;
950
951
import: RouteHandler<{
951
951
-
Body: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly;
952
952
+
Body: ImportData['body'];
952
953
Reply: {
953
953
-
200: Model_From_Zendesk;
954
954
+
'200': Model_From_Zendesk;
954
955
};
955
956
}>;
956
957
apiVVersionOdataControllerCount: RouteHandler<{
957
958
Reply: {
958
958
-
200: Model_From_Zendesk;
959
959
+
'200': Model_From_Zendesk;
959
960
};
960
961
}>;
961
962
getApiVbyApiVersionSimpleOperation: RouteHandler<{
962
962
-
Params: {
963
963
-
/**
964
964
-
* foo in method
965
965
-
*/
966
966
-
foo_param: string;
967
967
-
};
963
963
+
Params: GetApiVbyApiVersionSimpleOperationData['path'];
968
964
Reply: {
969
969
-
200: number;
965
965
+
'200': number;
970
966
};
971
967
}>;
972
968
deleteCallWithoutParametersAndResponse: RouteHandler<{}>;
···
977
973
postCallWithoutParametersAndResponse: RouteHandler<{}>;
978
974
putCallWithoutParametersAndResponse: RouteHandler<{}>;
979
975
deleteFoo: RouteHandler<{
980
980
-
Headers: {
981
981
-
/**
982
982
-
* Parameter with illegal characters
983
983
-
*/
984
984
-
'x-Foo-Bar': ModelWithString;
985
985
-
};
986
986
-
Params: {
987
987
-
/**
988
988
-
* foo in method
989
989
-
*/
990
990
-
foo_param: string;
991
991
-
/**
992
992
-
* bar in method
993
993
-
*/
994
994
-
BarParam: string;
995
995
-
};
976
976
+
Headers: DeleteFooData3['headers'];
977
977
+
Params: DeleteFooData3['path'];
996
978
}>;
997
979
callWithDescriptions: RouteHandler<{
998
998
-
Querystring?: {
999
999
-
/**
1000
1000
-
* Testing multiline comments in string: First line
1001
1001
-
* Second line
1002
1002
-
*
1003
1003
-
* Fourth line
1004
1004
-
*/
1005
1005
-
parameterWithBreaks?: string;
1006
1006
-
/**
1007
1007
-
* Testing backticks in string: `backticks` and ```multiple backticks``` should work
1008
1008
-
*/
1009
1009
-
parameterWithBackticks?: string;
1010
1010
-
/**
1011
1011
-
* Testing slashes in string: \backwards\\\ and /forwards/// should work
1012
1012
-
*/
1013
1013
-
parameterWithSlashes?: string;
1014
1014
-
/**
1015
1015
-
* Testing expression placeholders in string: ${expression} should work
1016
1016
-
*/
1017
1017
-
parameterWithExpressionPlaceholders?: string;
1018
1018
-
/**
1019
1019
-
* Testing quotes in string: 'single quote''' and "double quotes""" should work
1020
1020
-
*/
1021
1021
-
parameterWithQuotes?: string;
1022
1022
-
/**
1023
1023
-
* Testing reserved characters in string: * inline * and ** inline ** should work
1024
1024
-
*/
1025
1025
-
parameterWithReservedCharacters?: string;
1026
1026
-
};
980
980
+
Querystring?: CallWithDescriptionsData['query'];
1027
981
}>;
1028
982
deprecatedCall: RouteHandler<{
1029
1029
-
Headers: {
1030
1030
-
/**
1031
1031
-
* This parameter is deprecated
1032
1032
-
* @deprecated
1033
1033
-
*/
1034
1034
-
parameter: DeprecatedModel | null;
1035
1035
-
};
983
983
+
Headers: DeprecatedCallData['headers'];
1036
984
}>;
1037
985
callWithParameters: RouteHandler<{
1038
1038
-
Body: {} | null;
1039
1039
-
Headers: {
1040
1040
-
/**
1041
1041
-
* This is the parameter that goes into the header
1042
1042
-
*/
1043
1043
-
parameterHeader: string | null;
1044
1044
-
};
1045
1045
-
Querystring: {
1046
1046
-
foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo;
1047
1047
-
foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo;
1048
1048
-
/**
1049
1049
-
* This is the parameter that goes into the query params
1050
1050
-
*/
1051
1051
-
cursor: string | null;
1052
1052
-
};
1053
1053
-
Params: {
1054
1054
-
/**
1055
1055
-
* This is the parameter that goes into the path
1056
1056
-
*/
1057
1057
-
parameterPath: string | null;
1058
1058
-
/**
1059
1059
-
* api-version should be required in standalone clients
1060
1060
-
*/
1061
1061
-
'api-version': string | null;
1062
1062
-
};
986
986
+
Body: CallWithParametersData['body'];
987
987
+
Headers: CallWithParametersData['headers'];
988
988
+
Params: CallWithParametersData['path'];
989
989
+
Querystring: CallWithParametersData['query'];
1063
990
}>;
1064
991
callWithWeirdParameterNames: RouteHandler<{
1065
1065
-
Body: ModelWithString | null;
1066
1066
-
Headers: {
1067
1067
-
/**
1068
1068
-
* This is the parameter that goes into the request header
1069
1069
-
*/
1070
1070
-
'parameter.header': string | null;
1071
1071
-
};
1072
1072
-
Querystring: {
1073
1073
-
/**
1074
1074
-
* This is the parameter with a reserved keyword
1075
1075
-
*/
1076
1076
-
default?: string;
1077
1077
-
/**
1078
1078
-
* This is the parameter that goes into the request query params
1079
1079
-
*/
1080
1080
-
'parameter-query': string | null;
1081
1081
-
};
1082
1082
-
Params: {
1083
1083
-
/**
1084
1084
-
* This is the parameter that goes into the path
1085
1085
-
*/
1086
1086
-
'parameter.path.1'?: string;
1087
1087
-
/**
1088
1088
-
* This is the parameter that goes into the path
1089
1089
-
*/
1090
1090
-
'parameter-path-2'?: string;
1091
1091
-
/**
1092
1092
-
* This is the parameter that goes into the path
1093
1093
-
*/
1094
1094
-
'PARAMETER-PATH-3'?: string;
1095
1095
-
/**
1096
1096
-
* api-version should be required in standalone clients
1097
1097
-
*/
1098
1098
-
'api-version': string | null;
1099
1099
-
};
992
992
+
Body: CallWithWeirdParameterNamesData['body'];
993
993
+
Headers: CallWithWeirdParameterNamesData['headers'];
994
994
+
Params: CallWithWeirdParameterNamesData['path'];
995
995
+
Querystring: CallWithWeirdParameterNamesData['query'];
1100
996
}>;
1101
997
getCallWithOptionalParam: RouteHandler<{
1102
1102
-
Body: ModelWithOneOfEnum;
1103
1103
-
Querystring?: {
1104
1104
-
/**
1105
1105
-
* This is an optional parameter
1106
1106
-
*/
1107
1107
-
page?: number;
1108
1108
-
};
998
998
+
Body: GetCallWithOptionalParamData['body'];
999
999
+
Querystring?: GetCallWithOptionalParamData['query'];
1109
1000
}>;
1110
1001
postCallWithOptionalParam: RouteHandler<{
1111
1111
-
Body: {
1112
1112
-
offset?: number | null;
1113
1113
-
};
1114
1114
-
Querystring: {
1115
1115
-
/**
1116
1116
-
* This is a required parameter
1117
1117
-
*/
1118
1118
-
parameter: Pageable;
1119
1119
-
};
1002
1002
+
Body: PostCallWithOptionalParamData['body'];
1003
1003
+
Querystring: PostCallWithOptionalParamData['query'];
1120
1004
Reply: {
1121
1121
-
200: number;
1122
1122
-
204: void;
1005
1005
+
'200': number;
1006
1006
+
'204': void;
1123
1007
};
1124
1008
}>;
1125
1009
postApiVbyApiVersionRequestBody: RouteHandler<{
1126
1126
-
Body: ModelWithString;
1127
1127
-
Querystring?: {
1128
1128
-
/**
1129
1129
-
* This is a reusable parameter
1130
1130
-
*/
1131
1131
-
parameter?: string;
1132
1132
-
};
1010
1010
+
Body: PostApiVbyApiVersionRequestBodyData['body'];
1011
1011
+
Querystring?: PostApiVbyApiVersionRequestBodyData['query'];
1133
1012
}>;
1134
1013
postApiVbyApiVersionFormData: RouteHandler<{
1135
1135
-
Body: ModelWithString;
1136
1136
-
Querystring?: {
1137
1137
-
/**
1138
1138
-
* This is a reusable parameter
1139
1139
-
*/
1140
1140
-
parameter?: string;
1141
1141
-
};
1014
1014
+
Body: PostApiVbyApiVersionFormDataData['body'];
1015
1015
+
Querystring?: PostApiVbyApiVersionFormDataData['query'];
1142
1016
}>;
1143
1017
callWithDefaultParameters: RouteHandler<{
1144
1144
-
Querystring?: {
1145
1145
-
/**
1146
1146
-
* This is a simple string with default value
1147
1147
-
*/
1148
1148
-
parameterString?: string | null;
1149
1149
-
/**
1150
1150
-
* This is a simple number with default value
1151
1151
-
*/
1152
1152
-
parameterNumber?: number | null;
1153
1153
-
/**
1154
1154
-
* This is a simple boolean with default value
1155
1155
-
*/
1156
1156
-
parameterBoolean?: boolean | null;
1157
1157
-
/**
1158
1158
-
* This is a simple enum with default value
1159
1159
-
*/
1160
1160
-
parameterEnum?: 'Success' | 'Warning' | 'Error';
1161
1161
-
/**
1162
1162
-
* This is a simple model with default value
1163
1163
-
*/
1164
1164
-
parameterModel?: ModelWithString | null;
1165
1165
-
};
1018
1018
+
Querystring?: CallWithDefaultParametersData['query'];
1166
1019
}>;
1167
1020
callWithDefaultOptionalParameters: RouteHandler<{
1168
1168
-
Querystring?: {
1169
1169
-
/**
1170
1170
-
* This is a simple string that is optional with default value
1171
1171
-
*/
1172
1172
-
parameterString?: string;
1173
1173
-
/**
1174
1174
-
* This is a simple number that is optional with default value
1175
1175
-
*/
1176
1176
-
parameterNumber?: number;
1177
1177
-
/**
1178
1178
-
* This is a simple boolean that is optional with default value
1179
1179
-
*/
1180
1180
-
parameterBoolean?: boolean;
1181
1181
-
/**
1182
1182
-
* This is a simple enum that is optional with default value
1183
1183
-
*/
1184
1184
-
parameterEnum?: 'Success' | 'Warning' | 'Error';
1185
1185
-
/**
1186
1186
-
* This is a simple model that is optional with default value
1187
1187
-
*/
1188
1188
-
parameterModel?: ModelWithString;
1189
1189
-
};
1021
1021
+
Querystring?: CallWithDefaultOptionalParametersData['query'];
1190
1022
}>;
1191
1023
callToTestOrderOfParams: RouteHandler<{
1192
1192
-
Querystring: {
1193
1193
-
/**
1194
1194
-
* This is a optional string with default
1195
1195
-
*/
1196
1196
-
parameterOptionalStringWithDefault?: string;
1197
1197
-
/**
1198
1198
-
* This is a optional string with empty default
1199
1199
-
*/
1200
1200
-
parameterOptionalStringWithEmptyDefault?: string;
1201
1201
-
/**
1202
1202
-
* This is a optional string with no default
1203
1203
-
*/
1204
1204
-
parameterOptionalStringWithNoDefault?: string;
1205
1205
-
/**
1206
1206
-
* This is a string with default
1207
1207
-
*/
1208
1208
-
parameterStringWithDefault: string;
1209
1209
-
/**
1210
1210
-
* This is a string with empty default
1211
1211
-
*/
1212
1212
-
parameterStringWithEmptyDefault: string;
1213
1213
-
/**
1214
1214
-
* This is a string with no default
1215
1215
-
*/
1216
1216
-
parameterStringWithNoDefault: string;
1217
1217
-
/**
1218
1218
-
* This is a string that can be null with no default
1219
1219
-
*/
1220
1220
-
parameterStringNullableWithNoDefault?: string | null;
1221
1221
-
/**
1222
1222
-
* This is a string that can be null with default
1223
1223
-
*/
1224
1224
-
parameterStringNullableWithDefault?: string | null;
1225
1225
-
};
1024
1024
+
Querystring: CallToTestOrderOfParamsData['query'];
1226
1025
}>;
1227
1026
duplicateName: RouteHandler<{}>;
1228
1027
duplicateName2: RouteHandler<{}>;
···
1230
1029
duplicateName4: RouteHandler<{}>;
1231
1030
callWithNoContentResponse: RouteHandler<{
1232
1031
Reply: {
1233
1233
-
204: void;
1032
1032
+
'204': void;
1234
1033
};
1235
1034
}>;
1236
1035
callWithResponseAndNoContentResponse: RouteHandler<{
1237
1036
Reply: {
1238
1238
-
200: number;
1239
1239
-
204: void;
1037
1037
+
'200': number;
1038
1038
+
'204': void;
1240
1039
};
1241
1040
}>;
1242
1041
dummyA: RouteHandler<{
1243
1042
Reply: {
1244
1244
-
200: _400;
1043
1043
+
'200': _400;
1245
1044
};
1246
1045
}>;
1247
1046
dummyB: RouteHandler<{
1248
1047
Reply: {
1249
1249
-
204: void;
1048
1048
+
'204': void;
1250
1049
};
1251
1050
}>;
1252
1051
callWithResponse: RouteHandler<{
···
1254
1053
}>;
1255
1054
callWithDuplicateResponses: RouteHandler<{
1256
1055
Reply: {
1257
1257
-
200: ModelWithBoolean & ModelWithInteger;
1258
1258
-
201: ModelWithString;
1259
1259
-
202: ModelWithString;
1260
1260
-
500: ModelWithStringError;
1261
1261
-
501: ModelWithStringError;
1262
1262
-
502: ModelWithStringError;
1056
1056
+
'200': ModelWithBoolean & ModelWithInteger;
1057
1057
+
'201': ModelWithString;
1058
1058
+
'202': ModelWithString;
1059
1059
+
'500': ModelWithStringError;
1060
1060
+
'501': ModelWithStringError;
1061
1061
+
'502': ModelWithStringError;
1263
1062
'4XX': DictionaryWithArray;
1264
1063
};
1265
1064
}>;
1266
1065
callWithResponses: RouteHandler<{
1267
1066
Reply: {
1268
1268
-
200: {
1067
1067
+
'200': {
1269
1068
readonly '@namespace.string'?: string;
1270
1069
readonly '@namespace.integer'?: number;
1271
1070
readonly value?: Array<ModelWithString>;
1272
1071
};
1273
1273
-
201: ModelThatExtends;
1274
1274
-
202: ModelThatExtendsExtends;
1275
1275
-
500: ModelWithStringError;
1276
1276
-
501: ModelWithStringError;
1277
1277
-
502: ModelWithStringError;
1072
1072
+
'201': ModelThatExtends;
1073
1073
+
'202': ModelThatExtendsExtends;
1074
1074
+
'500': ModelWithStringError;
1075
1075
+
'501': ModelWithStringError;
1076
1076
+
'502': ModelWithStringError;
1278
1077
};
1279
1078
}>;
1280
1079
collectionFormat: RouteHandler<{
1281
1281
-
Querystring: {
1282
1282
-
/**
1283
1283
-
* This is an array parameter that is sent as csv format (comma-separated values)
1284
1284
-
*/
1285
1285
-
parameterArrayCSV: Array<string> | null;
1286
1286
-
/**
1287
1287
-
* This is an array parameter that is sent as ssv format (space-separated values)
1288
1288
-
*/
1289
1289
-
parameterArraySSV: Array<string> | null;
1290
1290
-
/**
1291
1291
-
* This is an array parameter that is sent as tsv format (tab-separated values)
1292
1292
-
*/
1293
1293
-
parameterArrayTSV: Array<string> | null;
1294
1294
-
/**
1295
1295
-
* This is an array parameter that is sent as pipes format (pipe-separated values)
1296
1296
-
*/
1297
1297
-
parameterArrayPipes: Array<string> | null;
1298
1298
-
/**
1299
1299
-
* This is an array parameter that is sent as multi format (multiple parameter instances)
1300
1300
-
*/
1301
1301
-
parameterArrayMulti: Array<string> | null;
1302
1302
-
};
1080
1080
+
Querystring: CollectionFormatData['query'];
1303
1081
}>;
1304
1082
types: RouteHandler<{
1305
1305
-
Querystring: {
1306
1306
-
/**
1307
1307
-
* This is a number parameter
1308
1308
-
*/
1309
1309
-
parameterNumber: number;
1310
1310
-
/**
1311
1311
-
* This is a string parameter
1312
1312
-
*/
1313
1313
-
parameterString: string | null;
1314
1314
-
/**
1315
1315
-
* This is a boolean parameter
1316
1316
-
*/
1317
1317
-
parameterBoolean: boolean | null;
1318
1318
-
/**
1319
1319
-
* This is an object parameter
1320
1320
-
*/
1321
1321
-
parameterObject: {} | null;
1322
1322
-
/**
1323
1323
-
* This is an array parameter
1324
1324
-
*/
1325
1325
-
parameterArray: Array<string> | null;
1326
1326
-
/**
1327
1327
-
* This is a dictionary parameter
1328
1328
-
*/
1329
1329
-
parameterDictionary: {} | null;
1330
1330
-
/**
1331
1331
-
* This is an enum parameter
1332
1332
-
*/
1333
1333
-
parameterEnum: 'Success' | 'Warning' | 'Error';
1334
1334
-
};
1335
1335
-
Params?: {
1336
1336
-
/**
1337
1337
-
* This is a number parameter
1338
1338
-
*/
1339
1339
-
id?: number;
1340
1340
-
};
1083
1083
+
Params?: TypesData['path'];
1084
1084
+
Querystring: TypesData['query'];
1341
1085
Reply: {
1342
1342
-
200: number;
1343
1343
-
201: string;
1344
1344
-
202: boolean;
1345
1345
-
203: {};
1086
1086
+
'200': number;
1087
1087
+
'201': string;
1088
1088
+
'202': boolean;
1089
1089
+
'203': {};
1346
1090
};
1347
1091
}>;
1348
1092
uploadFile: RouteHandler<{
1349
1349
-
Body: Blob | File;
1350
1350
-
Params: {
1351
1351
-
/**
1352
1352
-
* api-version should be required in standalone clients
1353
1353
-
*/
1354
1354
-
'api-version': string | null;
1355
1355
-
};
1093
1093
+
Body: UploadFileData['body'];
1094
1094
+
Params: UploadFileData['path'];
1356
1095
Reply: {
1357
1357
-
200: boolean;
1096
1096
+
'200': boolean;
1358
1097
};
1359
1098
}>;
1360
1099
fileResponse: RouteHandler<{
1361
1361
-
Params: {
1362
1362
-
id: string;
1363
1363
-
/**
1364
1364
-
* api-version should be required in standalone clients
1365
1365
-
*/
1366
1366
-
'api-version': string;
1367
1367
-
};
1100
1100
+
Params: FileResponseData['path'];
1368
1101
Reply: {
1369
1369
-
200: Blob | File;
1102
1102
+
'200': Blob | File;
1370
1103
};
1371
1104
}>;
1372
1105
complexTypes: RouteHandler<{
1373
1373
-
Querystring: {
1374
1374
-
/**
1375
1375
-
* Parameter containing object
1376
1376
-
*/
1377
1377
-
parameterObject: {
1378
1378
-
first?: {
1379
1379
-
second?: {
1380
1380
-
third?: string;
1381
1381
-
};
1382
1382
-
};
1383
1383
-
};
1384
1384
-
/**
1385
1385
-
* Parameter containing reference
1386
1386
-
*/
1387
1387
-
parameterReference: ModelWithString;
1388
1388
-
};
1106
1106
+
Querystring: ComplexTypesData['query'];
1389
1107
Reply: {
1390
1390
-
200: Array<ModelWithString>;
1391
1391
-
400: unknown;
1392
1392
-
500: unknown;
1108
1108
+
'200': Array<ModelWithString>;
1109
1109
+
'400': unknown;
1110
1110
+
'500': unknown;
1393
1111
};
1394
1112
}>;
1395
1113
multipartResponse: RouteHandler<{
1396
1114
Reply: {
1397
1397
-
200: {
1115
1115
+
'200': {
1398
1116
file?: Blob | File;
1399
1117
metadata?: {
1400
1118
foo?: string;
···
1404
1122
};
1405
1123
}>;
1406
1124
multipartRequest: RouteHandler<{
1407
1407
-
Body: {
1408
1408
-
content?: Blob | File;
1409
1409
-
data?: ModelWithString | null;
1410
1410
-
};
1125
1125
+
Body: MultipartRequestData['body'];
1411
1126
}>;
1412
1127
complexParams: RouteHandler<{
1413
1413
-
Body: {
1414
1414
-
readonly key: string | null;
1415
1415
-
name: string | null;
1416
1416
-
enabled?: boolean;
1417
1417
-
type: 'Monkey' | 'Horse' | 'Bird';
1418
1418
-
listOfModels?: Array<ModelWithString> | null;
1419
1419
-
listOfStrings?: Array<string> | null;
1420
1420
-
parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary;
1421
1421
-
readonly user?: {
1422
1422
-
readonly id?: number;
1423
1423
-
readonly name?: string | null;
1424
1424
-
};
1425
1425
-
};
1426
1426
-
Params: {
1427
1427
-
id: number;
1428
1428
-
/**
1429
1429
-
* api-version should be required in standalone clients
1430
1430
-
*/
1431
1431
-
'api-version': string;
1432
1432
-
};
1128
1128
+
Body: ComplexParamsData['body'];
1129
1129
+
Params: ComplexParamsData['path'];
1433
1130
Reply: {
1434
1434
-
200: ModelWithString;
1131
1131
+
'200': ModelWithString;
1435
1132
};
1436
1133
}>;
1437
1134
callWithResultFromHeader: RouteHandler<{
1438
1135
Reply: {
1439
1439
-
200: unknown;
1440
1440
-
400: unknown;
1441
1441
-
500: unknown;
1136
1136
+
'200': unknown;
1137
1137
+
'400': unknown;
1138
1138
+
'500': unknown;
1442
1139
};
1443
1140
}>;
1444
1141
testErrorCode: RouteHandler<{
1445
1445
-
Querystring: {
1446
1446
-
/**
1447
1447
-
* Status code to return
1448
1448
-
*/
1449
1449
-
status: number;
1450
1450
-
};
1142
1142
+
Querystring: TestErrorCodeData['query'];
1451
1143
Reply: {
1452
1452
-
200: unknown;
1453
1453
-
500: unknown;
1454
1454
-
501: unknown;
1455
1455
-
502: unknown;
1456
1456
-
503: unknown;
1144
1144
+
'200': unknown;
1145
1145
+
'500': unknown;
1146
1146
+
'501': unknown;
1147
1147
+
'502': unknown;
1148
1148
+
'503': unknown;
1457
1149
};
1458
1150
}>;
1459
1151
nonAsciiæøåÆøÅöôêÊ字符串: RouteHandler<{
1460
1460
-
Querystring: {
1461
1461
-
/**
1462
1462
-
* Dummy input param
1463
1463
-
*/
1464
1464
-
nonAsciiParamæøåÆØÅöôêÊ: number;
1465
1465
-
};
1152
1152
+
Querystring: NonAsciiæøåÆøÅöôêÊ字符串Data['query'];
1466
1153
Reply: {
1467
1467
-
200: Array<NonAsciiStringæøåÆØÅöôêÊ字符串>;
1154
1154
+
'200': Array<NonAsciiStringæøåÆØÅöôêÊ字符串>;
1468
1155
};
1469
1156
}>;
1470
1157
putWithFormUrlEncoded: RouteHandler<{
1471
1471
-
Body: ArrayWithStrings;
1158
1158
+
Body: PutWithFormUrlEncodedData['body'];
1472
1159
}>;
1473
1160
};
+81
-394
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/fastify/default/fastify.gen.ts
···
1
1
// This file is auto-generated by @hey-api/openapi-ts
2
2
3
3
import type { RouteHandler } from 'fastify';
4
4
+
import type { ImportData, GetApiVbyApiVersionSimpleOperationData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CollectionFormatData, TypesData, UploadFileData, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, PutWithFormUrlEncodedData } from './types.gen';
4
5
5
6
/**
6
7
* Model with number-only name
···
952
953
export type RouteHandlers = {
953
954
export: RouteHandler<{}>;
954
955
import: RouteHandler<{
955
955
-
Body: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly;
956
956
+
Body: ImportData['body'];
956
957
Reply: {
957
957
-
200: Model_From_Zendesk;
958
958
+
'200': Model_From_Zendesk;
958
959
};
959
960
}>;
960
961
apiVVersionOdataControllerCount: RouteHandler<{
961
962
Reply: {
962
962
-
200: Model_From_Zendesk;
963
963
+
'200': Model_From_Zendesk;
963
964
};
964
965
}>;
965
966
getApiVbyApiVersionSimpleOperation: RouteHandler<{
966
966
-
Params: {
967
967
-
/**
968
968
-
* foo in method
969
969
-
*/
970
970
-
foo_param: unknown;
971
971
-
};
967
967
+
Params: GetApiVbyApiVersionSimpleOperationData['path'];
972
968
Reply: {
973
973
-
200: number;
969
969
+
'200': number;
974
970
};
975
971
}>;
976
972
deleteCallWithoutParametersAndResponse: RouteHandler<{}>;
···
981
977
postCallWithoutParametersAndResponse: RouteHandler<{}>;
982
978
putCallWithoutParametersAndResponse: RouteHandler<{}>;
983
979
deleteFoo: RouteHandler<{
984
984
-
Headers: {
985
985
-
/**
986
986
-
* Parameter with illegal characters
987
987
-
*/
988
988
-
'x-Foo-Bar': ModelWithString;
989
989
-
};
990
990
-
Params: {
991
991
-
/**
992
992
-
* foo in method
993
993
-
*/
994
994
-
foo_param: string;
995
995
-
/**
996
996
-
* bar in method
997
997
-
*/
998
998
-
BarParam: string;
999
999
-
};
980
980
+
Headers: DeleteFooData3['headers'];
981
981
+
Params: DeleteFooData3['path'];
1000
982
}>;
1001
983
callWithDescriptions: RouteHandler<{
1002
1002
-
Querystring?: {
1003
1003
-
/**
1004
1004
-
* Testing multiline comments in string: First line
1005
1005
-
* Second line
1006
1006
-
*
1007
1007
-
* Fourth line
1008
1008
-
*/
1009
1009
-
parameterWithBreaks?: string;
1010
1010
-
/**
1011
1011
-
* Testing backticks in string: `backticks` and ```multiple backticks``` should work
1012
1012
-
*/
1013
1013
-
parameterWithBackticks?: string;
1014
1014
-
/**
1015
1015
-
* Testing slashes in string: \backwards\\\ and /forwards/// should work
1016
1016
-
*/
1017
1017
-
parameterWithSlashes?: string;
1018
1018
-
/**
1019
1019
-
* Testing expression placeholders in string: ${expression} should work
1020
1020
-
*/
1021
1021
-
parameterWithExpressionPlaceholders?: string;
1022
1022
-
/**
1023
1023
-
* Testing quotes in string: 'single quote''' and "double quotes""" should work
1024
1024
-
*/
1025
1025
-
parameterWithQuotes?: string;
1026
1026
-
/**
1027
1027
-
* Testing reserved characters in string: * inline * and ** inline ** should work
1028
1028
-
*/
1029
1029
-
parameterWithReservedCharacters?: string;
1030
1030
-
};
984
984
+
Querystring?: CallWithDescriptionsData['query'];
1031
985
}>;
1032
986
deprecatedCall: RouteHandler<{
1033
1033
-
Headers: {
1034
1034
-
/**
1035
1035
-
* This parameter is deprecated
1036
1036
-
* @deprecated
1037
1037
-
*/
1038
1038
-
parameter: DeprecatedModel | null;
1039
1039
-
};
987
987
+
Headers: DeprecatedCallData['headers'];
1040
988
}>;
1041
989
callWithParameters: RouteHandler<{
1042
1042
-
Body: {} | null;
1043
1043
-
Headers: {
1044
1044
-
/**
1045
1045
-
* This is the parameter that goes into the header
1046
1046
-
*/
1047
1047
-
parameterHeader: string | null;
1048
1048
-
};
1049
1049
-
Querystring: {
1050
1050
-
foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo;
1051
1051
-
foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo;
1052
1052
-
/**
1053
1053
-
* This is the parameter that goes into the query params
1054
1054
-
*/
1055
1055
-
cursor: string | null;
1056
1056
-
};
1057
1057
-
Params: {
1058
1058
-
/**
1059
1059
-
* This is the parameter that goes into the path
1060
1060
-
*/
1061
1061
-
parameterPath: string | null;
1062
1062
-
/**
1063
1063
-
* api-version should be required in standalone clients
1064
1064
-
*/
1065
1065
-
'api-version': string | null;
1066
1066
-
};
990
990
+
Body: CallWithParametersData['body'];
991
991
+
Headers: CallWithParametersData['headers'];
992
992
+
Params: CallWithParametersData['path'];
993
993
+
Querystring: CallWithParametersData['query'];
1067
994
}>;
1068
995
callWithWeirdParameterNames: RouteHandler<{
1069
1069
-
Body: ModelWithString | null;
1070
1070
-
Headers: {
1071
1071
-
/**
1072
1072
-
* This is the parameter that goes into the request header
1073
1073
-
*/
1074
1074
-
'parameter.header': string | null;
1075
1075
-
};
1076
1076
-
Querystring: {
1077
1077
-
/**
1078
1078
-
* This is the parameter with a reserved keyword
1079
1079
-
*/
1080
1080
-
default?: string;
1081
1081
-
/**
1082
1082
-
* This is the parameter that goes into the request query params
1083
1083
-
*/
1084
1084
-
'parameter-query': string | null;
1085
1085
-
};
1086
1086
-
Params: {
1087
1087
-
/**
1088
1088
-
* This is the parameter that goes into the path
1089
1089
-
*/
1090
1090
-
'parameter.path.1'?: string;
1091
1091
-
/**
1092
1092
-
* This is the parameter that goes into the path
1093
1093
-
*/
1094
1094
-
'parameter-path-2'?: string;
1095
1095
-
/**
1096
1096
-
* This is the parameter that goes into the path
1097
1097
-
*/
1098
1098
-
'PARAMETER-PATH-3'?: string;
1099
1099
-
/**
1100
1100
-
* api-version should be required in standalone clients
1101
1101
-
*/
1102
1102
-
'api-version': string | null;
1103
1103
-
};
996
996
+
Body: CallWithWeirdParameterNamesData['body'];
997
997
+
Headers: CallWithWeirdParameterNamesData['headers'];
998
998
+
Params: CallWithWeirdParameterNamesData['path'];
999
999
+
Querystring: CallWithWeirdParameterNamesData['query'];
1104
1000
}>;
1105
1001
getCallWithOptionalParam: RouteHandler<{
1106
1106
-
Body: ModelWithOneOfEnum;
1107
1107
-
Querystring?: {
1108
1108
-
/**
1109
1109
-
* This is an optional parameter
1110
1110
-
*/
1111
1111
-
page?: number;
1112
1112
-
};
1002
1002
+
Body: GetCallWithOptionalParamData['body'];
1003
1003
+
Querystring?: GetCallWithOptionalParamData['query'];
1113
1004
}>;
1114
1005
postCallWithOptionalParam: RouteHandler<{
1115
1115
-
Body: {
1116
1116
-
offset?: number | null;
1117
1117
-
};
1118
1118
-
Querystring: {
1119
1119
-
/**
1120
1120
-
* This is a required parameter
1121
1121
-
*/
1122
1122
-
parameter: Pageable;
1123
1123
-
};
1006
1006
+
Body: PostCallWithOptionalParamData['body'];
1007
1007
+
Querystring: PostCallWithOptionalParamData['query'];
1124
1008
Reply: {
1125
1125
-
200: number;
1126
1126
-
204: void;
1009
1009
+
'200': number;
1010
1010
+
'204': void;
1127
1011
};
1128
1012
}>;
1129
1013
postApiVbyApiVersionRequestBody: RouteHandler<{
1130
1130
-
Body: ModelWithString;
1131
1131
-
Querystring?: {
1132
1132
-
/**
1133
1133
-
* This is a reusable parameter
1134
1134
-
*/
1135
1135
-
parameter?: string;
1136
1136
-
};
1014
1014
+
Body: PostApiVbyApiVersionRequestBodyData['body'];
1015
1015
+
Querystring?: PostApiVbyApiVersionRequestBodyData['query'];
1137
1016
}>;
1138
1017
postApiVbyApiVersionFormData: RouteHandler<{
1139
1139
-
Body: ModelWithString;
1140
1140
-
Querystring?: {
1141
1141
-
/**
1142
1142
-
* This is a reusable parameter
1143
1143
-
*/
1144
1144
-
parameter?: string;
1145
1145
-
};
1018
1018
+
Body: PostApiVbyApiVersionFormDataData['body'];
1019
1019
+
Querystring?: PostApiVbyApiVersionFormDataData['query'];
1146
1020
}>;
1147
1021
callWithDefaultParameters: RouteHandler<{
1148
1148
-
Querystring?: {
1149
1149
-
/**
1150
1150
-
* This is a simple string with default value
1151
1151
-
*/
1152
1152
-
parameterString?: string | null;
1153
1153
-
/**
1154
1154
-
* This is a simple number with default value
1155
1155
-
*/
1156
1156
-
parameterNumber?: number | null;
1157
1157
-
/**
1158
1158
-
* This is a simple boolean with default value
1159
1159
-
*/
1160
1160
-
parameterBoolean?: boolean | null;
1161
1161
-
/**
1162
1162
-
* This is a simple enum with default value
1163
1163
-
*/
1164
1164
-
parameterEnum?: 'Success' | 'Warning' | 'Error';
1165
1165
-
/**
1166
1166
-
* This is a simple model with default value
1167
1167
-
*/
1168
1168
-
parameterModel?: ModelWithString | null;
1169
1169
-
};
1022
1022
+
Querystring?: CallWithDefaultParametersData['query'];
1170
1023
}>;
1171
1024
callWithDefaultOptionalParameters: RouteHandler<{
1172
1172
-
Querystring?: {
1173
1173
-
/**
1174
1174
-
* This is a simple string that is optional with default value
1175
1175
-
*/
1176
1176
-
parameterString?: string;
1177
1177
-
/**
1178
1178
-
* This is a simple number that is optional with default value
1179
1179
-
*/
1180
1180
-
parameterNumber?: number;
1181
1181
-
/**
1182
1182
-
* This is a simple boolean that is optional with default value
1183
1183
-
*/
1184
1184
-
parameterBoolean?: boolean;
1185
1185
-
/**
1186
1186
-
* This is a simple enum that is optional with default value
1187
1187
-
*/
1188
1188
-
parameterEnum?: 'Success' | 'Warning' | 'Error';
1189
1189
-
/**
1190
1190
-
* This is a simple model that is optional with default value
1191
1191
-
*/
1192
1192
-
parameterModel?: ModelWithString;
1193
1193
-
};
1025
1025
+
Querystring?: CallWithDefaultOptionalParametersData['query'];
1194
1026
}>;
1195
1027
callToTestOrderOfParams: RouteHandler<{
1196
1196
-
Querystring: {
1197
1197
-
/**
1198
1198
-
* This is a optional string with default
1199
1199
-
*/
1200
1200
-
parameterOptionalStringWithDefault?: string;
1201
1201
-
/**
1202
1202
-
* This is a optional string with empty default
1203
1203
-
*/
1204
1204
-
parameterOptionalStringWithEmptyDefault?: string;
1205
1205
-
/**
1206
1206
-
* This is a optional string with no default
1207
1207
-
*/
1208
1208
-
parameterOptionalStringWithNoDefault?: string;
1209
1209
-
/**
1210
1210
-
* This is a string with default
1211
1211
-
*/
1212
1212
-
parameterStringWithDefault: string;
1213
1213
-
/**
1214
1214
-
* This is a string with empty default
1215
1215
-
*/
1216
1216
-
parameterStringWithEmptyDefault: string;
1217
1217
-
/**
1218
1218
-
* This is a string with no default
1219
1219
-
*/
1220
1220
-
parameterStringWithNoDefault: string;
1221
1221
-
/**
1222
1222
-
* This is a string that can be null with no default
1223
1223
-
*/
1224
1224
-
parameterStringNullableWithNoDefault?: string | null;
1225
1225
-
/**
1226
1226
-
* This is a string that can be null with default
1227
1227
-
*/
1228
1228
-
parameterStringNullableWithDefault?: string | null;
1229
1229
-
};
1028
1028
+
Querystring: CallToTestOrderOfParamsData['query'];
1230
1029
}>;
1231
1030
duplicateName: RouteHandler<{}>;
1232
1031
duplicateName2: RouteHandler<{}>;
···
1234
1033
duplicateName4: RouteHandler<{}>;
1235
1034
callWithNoContentResponse: RouteHandler<{
1236
1035
Reply: {
1237
1237
-
204: void;
1036
1036
+
'204': void;
1238
1037
};
1239
1038
}>;
1240
1039
callWithResponseAndNoContentResponse: RouteHandler<{
1241
1040
Reply: {
1242
1242
-
200: number;
1243
1243
-
204: void;
1041
1041
+
'200': number;
1042
1042
+
'204': void;
1244
1043
};
1245
1044
}>;
1246
1045
dummyA: RouteHandler<{
1247
1046
Reply: {
1248
1248
-
200: _400;
1047
1047
+
'200': _400;
1249
1048
};
1250
1049
}>;
1251
1050
dummyB: RouteHandler<{
1252
1051
Reply: {
1253
1253
-
204: void;
1052
1052
+
'204': void;
1254
1053
};
1255
1054
}>;
1256
1055
callWithResponse: RouteHandler<{
···
1258
1057
}>;
1259
1058
callWithDuplicateResponses: RouteHandler<{
1260
1059
Reply: {
1261
1261
-
200: ModelWithBoolean & ModelWithInteger;
1262
1262
-
201: ModelWithString;
1263
1263
-
202: ModelWithString;
1264
1264
-
500: ModelWithStringError;
1265
1265
-
501: ModelWithStringError;
1266
1266
-
502: ModelWithStringError;
1060
1060
+
'200': ModelWithBoolean & ModelWithInteger;
1061
1061
+
'201': ModelWithString;
1062
1062
+
'202': ModelWithString;
1063
1063
+
'500': ModelWithStringError;
1064
1064
+
'501': ModelWithStringError;
1065
1065
+
'502': ModelWithStringError;
1267
1066
'4XX': DictionaryWithArray;
1268
1067
};
1269
1068
}>;
1270
1069
callWithResponses: RouteHandler<{
1271
1070
Reply: {
1272
1272
-
200: {
1071
1071
+
'200': {
1273
1072
readonly '@namespace.string'?: string;
1274
1073
readonly '@namespace.integer'?: number;
1275
1074
readonly value?: Array<ModelWithString>;
1276
1075
};
1277
1277
-
201: ModelThatExtends;
1278
1278
-
202: ModelThatExtendsExtends;
1279
1279
-
500: ModelWithStringError;
1280
1280
-
501: ModelWithStringError;
1281
1281
-
502: ModelWithStringError;
1076
1076
+
'201': ModelThatExtends;
1077
1077
+
'202': ModelThatExtendsExtends;
1078
1078
+
'500': ModelWithStringError;
1079
1079
+
'501': ModelWithStringError;
1080
1080
+
'502': ModelWithStringError;
1282
1081
};
1283
1082
}>;
1284
1083
collectionFormat: RouteHandler<{
1285
1285
-
Querystring: {
1286
1286
-
/**
1287
1287
-
* This is an array parameter that is sent as csv format (comma-separated values)
1288
1288
-
*/
1289
1289
-
parameterArrayCSV: Array<string> | null;
1290
1290
-
/**
1291
1291
-
* This is an array parameter that is sent as ssv format (space-separated values)
1292
1292
-
*/
1293
1293
-
parameterArraySSV: Array<string> | null;
1294
1294
-
/**
1295
1295
-
* This is an array parameter that is sent as tsv format (tab-separated values)
1296
1296
-
*/
1297
1297
-
parameterArrayTSV: Array<string> | null;
1298
1298
-
/**
1299
1299
-
* This is an array parameter that is sent as pipes format (pipe-separated values)
1300
1300
-
*/
1301
1301
-
parameterArrayPipes: Array<string> | null;
1302
1302
-
/**
1303
1303
-
* This is an array parameter that is sent as multi format (multiple parameter instances)
1304
1304
-
*/
1305
1305
-
parameterArrayMulti: Array<string> | null;
1306
1306
-
};
1084
1084
+
Querystring: CollectionFormatData['query'];
1307
1085
}>;
1308
1086
types: RouteHandler<{
1309
1309
-
Querystring: {
1310
1310
-
/**
1311
1311
-
* This is a number parameter
1312
1312
-
*/
1313
1313
-
parameterNumber: number;
1314
1314
-
/**
1315
1315
-
* This is a string parameter
1316
1316
-
*/
1317
1317
-
parameterString: string | null;
1318
1318
-
/**
1319
1319
-
* This is a boolean parameter
1320
1320
-
*/
1321
1321
-
parameterBoolean: boolean | null;
1322
1322
-
/**
1323
1323
-
* This is an object parameter
1324
1324
-
*/
1325
1325
-
parameterObject: {} | null;
1326
1326
-
/**
1327
1327
-
* This is an array parameter
1328
1328
-
*/
1329
1329
-
parameterArray: Array<string> | null;
1330
1330
-
/**
1331
1331
-
* This is a dictionary parameter
1332
1332
-
*/
1333
1333
-
parameterDictionary: {} | null;
1334
1334
-
/**
1335
1335
-
* This is an enum parameter
1336
1336
-
*/
1337
1337
-
parameterEnum: 'Success' | 'Warning' | 'Error' | null;
1338
1338
-
};
1339
1339
-
Params?: {
1340
1340
-
/**
1341
1341
-
* This is a number parameter
1342
1342
-
*/
1343
1343
-
id?: number;
1344
1344
-
};
1087
1087
+
Params?: TypesData['path'];
1088
1088
+
Querystring: TypesData['query'];
1345
1089
Reply: {
1346
1346
-
200: number;
1347
1347
-
201: string;
1348
1348
-
202: boolean;
1349
1349
-
203: {};
1090
1090
+
'200': number;
1091
1091
+
'201': string;
1092
1092
+
'202': boolean;
1093
1093
+
'203': {};
1350
1094
};
1351
1095
}>;
1352
1096
uploadFile: RouteHandler<{
1353
1353
-
Body: Blob | File;
1354
1354
-
Params: {
1355
1355
-
/**
1356
1356
-
* api-version should be required in standalone clients
1357
1357
-
*/
1358
1358
-
'api-version': string | null;
1359
1359
-
};
1097
1097
+
Body: UploadFileData['body'];
1098
1098
+
Params: UploadFileData['path'];
1360
1099
Reply: {
1361
1361
-
200: boolean;
1100
1100
+
'200': boolean;
1362
1101
};
1363
1102
}>;
1364
1103
fileResponse: RouteHandler<{
1365
1365
-
Params: {
1366
1366
-
id: string;
1367
1367
-
/**
1368
1368
-
* api-version should be required in standalone clients
1369
1369
-
*/
1370
1370
-
'api-version': string;
1371
1371
-
};
1104
1104
+
Params: FileResponseData['path'];
1372
1105
Reply: {
1373
1373
-
200: Blob | File;
1106
1106
+
'200': Blob | File;
1374
1107
};
1375
1108
}>;
1376
1109
complexTypes: RouteHandler<{
1377
1377
-
Querystring: {
1378
1378
-
/**
1379
1379
-
* Parameter containing object
1380
1380
-
*/
1381
1381
-
parameterObject: {
1382
1382
-
first?: {
1383
1383
-
second?: {
1384
1384
-
third?: string;
1385
1385
-
};
1386
1386
-
};
1387
1387
-
};
1388
1388
-
/**
1389
1389
-
* Parameter containing reference
1390
1390
-
*/
1391
1391
-
parameterReference: ModelWithString;
1392
1392
-
};
1110
1110
+
Querystring: ComplexTypesData['query'];
1393
1111
Reply: {
1394
1394
-
200: Array<ModelWithString>;
1395
1395
-
400: unknown;
1396
1396
-
500: unknown;
1112
1112
+
'200': Array<ModelWithString>;
1113
1113
+
'400': unknown;
1114
1114
+
'500': unknown;
1397
1115
};
1398
1116
}>;
1399
1117
multipartResponse: RouteHandler<{
1400
1118
Reply: {
1401
1401
-
200: {
1119
1119
+
'200': {
1402
1120
file?: Blob | File;
1403
1121
metadata?: {
1404
1122
foo?: string;
···
1408
1126
};
1409
1127
}>;
1410
1128
multipartRequest: RouteHandler<{
1411
1411
-
Body: {
1412
1412
-
content?: Blob | File;
1413
1413
-
data?: ModelWithString | null;
1414
1414
-
};
1129
1129
+
Body: MultipartRequestData['body'];
1415
1130
}>;
1416
1131
complexParams: RouteHandler<{
1417
1417
-
Body: {
1418
1418
-
readonly key: string | null;
1419
1419
-
name: string | null;
1420
1420
-
enabled?: boolean;
1421
1421
-
type: 'Monkey' | 'Horse' | 'Bird';
1422
1422
-
listOfModels?: Array<ModelWithString> | null;
1423
1423
-
listOfStrings?: Array<string> | null;
1424
1424
-
parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary;
1425
1425
-
readonly user?: {
1426
1426
-
readonly id?: number;
1427
1427
-
readonly name?: string | null;
1428
1428
-
};
1429
1429
-
};
1430
1430
-
Params: {
1431
1431
-
id: number;
1432
1432
-
/**
1433
1433
-
* api-version should be required in standalone clients
1434
1434
-
*/
1435
1435
-
'api-version': string;
1436
1436
-
};
1132
1132
+
Body: ComplexParamsData['body'];
1133
1133
+
Params: ComplexParamsData['path'];
1437
1134
Reply: {
1438
1438
-
200: ModelWithString;
1135
1135
+
'200': ModelWithString;
1439
1136
};
1440
1137
}>;
1441
1138
callWithResultFromHeader: RouteHandler<{
1442
1139
Reply: {
1443
1443
-
200: unknown;
1444
1444
-
400: unknown;
1445
1445
-
500: unknown;
1140
1140
+
'200': unknown;
1141
1141
+
'400': unknown;
1142
1142
+
'500': unknown;
1446
1143
};
1447
1144
}>;
1448
1145
testErrorCode: RouteHandler<{
1449
1449
-
Querystring: {
1450
1450
-
/**
1451
1451
-
* Status code to return
1452
1452
-
*/
1453
1453
-
status: number;
1454
1454
-
};
1146
1146
+
Querystring: TestErrorCodeData['query'];
1455
1147
Reply: {
1456
1456
-
200: unknown;
1457
1457
-
500: unknown;
1458
1458
-
501: unknown;
1459
1459
-
502: unknown;
1460
1460
-
503: unknown;
1148
1148
+
'200': unknown;
1149
1149
+
'500': unknown;
1150
1150
+
'501': unknown;
1151
1151
+
'502': unknown;
1152
1152
+
'503': unknown;
1461
1153
};
1462
1154
}>;
1463
1155
nonAsciiæøåÆøÅöôêÊ字符串: RouteHandler<{
1464
1464
-
Querystring: {
1465
1465
-
/**
1466
1466
-
* Dummy input param
1467
1467
-
*/
1468
1468
-
nonAsciiParamæøåÆØÅöôêÊ: number;
1469
1469
-
};
1156
1156
+
Querystring: NonAsciiæøåÆøÅöôêÊ字符串Data['query'];
1470
1157
Reply: {
1471
1471
-
200: Array<NonAsciiStringæøåÆØÅöôêÊ字符串>;
1158
1158
+
'200': Array<NonAsciiStringæøåÆØÅöôêÊ字符串>;
1472
1159
};
1473
1160
}>;
1474
1161
putWithFormUrlEncoded: RouteHandler<{
1475
1475
-
Body: ArrayWithStrings;
1162
1162
+
Body: PutWithFormUrlEncodedData['body'];
1476
1163
}>;
1477
1164
};