fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #869 from SamuelGuillemet/fix/conditional_service_types

authored by

Lubos and committed by
GitHub
9338037a 650a406b

+10 -422
+5
.changeset/wicked-lizards-admire.md
··· 1 + --- 2 + '@hey-api/openapi-ts': patch 3 + --- 4 + 5 + fix: add conditionnal generation for service related types
+4
packages/openapi-ts/src/generate/types.ts
··· 287 287 288 288 const config = getConfig(); 289 289 290 + if (!config.services.export && !config.types.tree) { 291 + return; 292 + } 293 + 290 294 const isStandalone = isStandaloneClient(config); 291 295 292 296 for (const service of client.services) {
+1 -422
packages/openapi-ts/test/__snapshots__/test/generated/v3_types_no_tree/types.gen.ts.snap
··· 882 882 /** 883 883 * Parameter with illegal characters 884 884 */ 885 - export type Parameterx_Foo_Bar = ModelWithString; 886 - 887 - export type ImportData = { 888 - requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; 889 - }; 890 - 891 - export type ImportResponse = Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly; 892 - 893 - export type ApiVversionOdataControllerCountResponse = Model_From_Zendesk; 894 - 895 - export type DeleteFooData3 = { 896 - /** 897 - * bar in method 898 - */ 899 - barParam: string; 900 - /** 901 - * foo in method 902 - */ 903 - fooParam: string; 904 - /** 905 - * Parameter with illegal characters 906 - */ 907 - xFooBar: ModelWithString; 908 - }; 909 - 910 - export type CallWithDescriptionsData = { 911 - /** 912 - * Testing backticks in string: `backticks` and ```multiple backticks``` should work 913 - */ 914 - parameterWithBackticks?: unknown; 915 - /** 916 - * Testing multiline comments in string: First line 917 - * Second line 918 - * 919 - * Fourth line 920 - */ 921 - parameterWithBreaks?: unknown; 922 - /** 923 - * Testing expression placeholders in string: ${expression} should work 924 - */ 925 - parameterWithExpressionPlaceholders?: unknown; 926 - /** 927 - * Testing quotes in string: 'single quote''' and "double quotes""" should work 928 - */ 929 - parameterWithQuotes?: unknown; 930 - /** 931 - * Testing reserved characters in string: * inline * and ** inline ** should work 932 - */ 933 - parameterWithReservedCharacters?: unknown; 934 - /** 935 - * Testing slashes in string: \backwards\\\ and /forwards/// should work 936 - */ 937 - parameterWithSlashes?: unknown; 938 - }; 939 - 940 - export type DeprecatedCallData = { 941 - /** 942 - * This parameter is deprecated 943 - * @deprecated 944 - */ 945 - parameter: DeprecatedModel | null; 946 - }; 947 - 948 - export type CallWithParametersData = { 949 - fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; 950 - fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; 951 - /** 952 - * This is the parameter that goes into the cookie 953 - */ 954 - parameterCookie: string | null; 955 - /** 956 - * This is the parameter that goes into the header 957 - */ 958 - parameterHeader: string | null; 959 - /** 960 - * This is the parameter that goes into the path 961 - */ 962 - parameterPath: string | null; 963 - /** 964 - * This is the parameter that goes into the query params 965 - */ 966 - parameterQuery: string | null; 967 - /** 968 - * This is the parameter that goes into the body 969 - */ 970 - requestBody: { 971 - [key: string]: unknown; 972 - } | null; 973 - }; 974 - 975 - export type CallWithWeirdParameterNamesData = { 976 - /** 977 - * This is the parameter with a reserved keyword 978 - */ 979 - _default?: string; 980 - /** 981 - * This is the parameter that goes into the cookie 982 - */ 983 - parameterCookie: string | null; 984 - /** 985 - * This is the parameter that goes into the request header 986 - */ 987 - parameterHeader: string | null; 988 - /** 989 - * This is the parameter that goes into the path 990 - */ 991 - parameterPath1?: string; 992 - /** 993 - * This is the parameter that goes into the path 994 - */ 995 - parameterPath2?: string; 996 - /** 997 - * This is the parameter that goes into the path 998 - */ 999 - parameterPath3?: string; 1000 - /** 1001 - * This is the parameter that goes into the request query params 1002 - */ 1003 - parameterQuery: string | null; 1004 - /** 1005 - * This is the parameter that goes into the body 1006 - */ 1007 - requestBody: ModelWithString | null; 1008 - }; 1009 - 1010 - export type GetCallWithOptionalParamData = { 1011 - /** 1012 - * This is an optional parameter 1013 - */ 1014 - parameter?: string; 1015 - /** 1016 - * This is a required parameter 1017 - */ 1018 - requestBody: ModelWithOneOfEnum; 1019 - }; 1020 - 1021 - export type PostCallWithOptionalParamData = { 1022 - /** 1023 - * This is a required parameter 1024 - */ 1025 - parameter: Pageable; 1026 - /** 1027 - * This is an optional parameter 1028 - */ 1029 - requestBody?: ModelWithString; 1030 - }; 1031 - 1032 - export type PostApiRequestBodyData = { 1033 - /** 1034 - * A reusable request body 1035 - */ 1036 - foo?: ModelWithString; 1037 - /** 1038 - * This is a reusable parameter 1039 - */ 1040 - parameter?: string; 1041 - }; 1042 - 1043 - export type PostApiFormDataData = { 1044 - /** 1045 - * A reusable request body 1046 - */ 1047 - formData?: ModelWithString; 1048 - /** 1049 - * This is a reusable parameter 1050 - */ 1051 - parameter?: string; 1052 - }; 1053 - 1054 - export type CallWithDefaultParametersData = { 1055 - /** 1056 - * This is a simple boolean with default value 1057 - */ 1058 - parameterBoolean?: boolean | null; 1059 - /** 1060 - * This is a simple enum with default value 1061 - */ 1062 - parameterEnum?: 'Success' | 'Warning' | 'Error'; 1063 - /** 1064 - * This is a simple model with default value 1065 - */ 1066 - parameterModel?: ModelWithString | null; 1067 - /** 1068 - * This is a simple number with default value 1069 - */ 1070 - parameterNumber?: number | null; 1071 - /** 1072 - * This is a simple string with default value 1073 - */ 1074 - parameterString?: string | null; 1075 - }; 1076 - 1077 - export type CallWithDefaultOptionalParametersData = { 1078 - /** 1079 - * This is a simple boolean that is optional with default value 1080 - */ 1081 - parameterBoolean?: boolean; 1082 - /** 1083 - * This is a simple enum that is optional with default value 1084 - */ 1085 - parameterEnum?: 'Success' | 'Warning' | 'Error'; 1086 - /** 1087 - * This is a simple model that is optional with default value 1088 - */ 1089 - parameterModel?: ModelWithString; 1090 - /** 1091 - * This is a simple number that is optional with default value 1092 - */ 1093 - parameterNumber?: number; 1094 - /** 1095 - * This is a simple string that is optional with default value 1096 - */ 1097 - parameterString?: string; 1098 - }; 1099 - 1100 - export type CallToTestOrderOfParamsData = { 1101 - /** 1102 - * This is a optional string with default 1103 - */ 1104 - parameterOptionalStringWithDefault?: string; 1105 - /** 1106 - * This is a optional string with empty default 1107 - */ 1108 - parameterOptionalStringWithEmptyDefault?: string; 1109 - /** 1110 - * This is a optional string with no default 1111 - */ 1112 - parameterOptionalStringWithNoDefault?: string; 1113 - /** 1114 - * This is a string that can be null with default 1115 - */ 1116 - parameterStringNullableWithDefault?: string | null; 1117 - /** 1118 - * This is a string that can be null with no default 1119 - */ 1120 - parameterStringNullableWithNoDefault?: string | null; 1121 - /** 1122 - * This is a string with default 1123 - */ 1124 - parameterStringWithDefault: string; 1125 - /** 1126 - * This is a string with empty default 1127 - */ 1128 - parameterStringWithEmptyDefault: string; 1129 - /** 1130 - * This is a string with no default 1131 - */ 1132 - parameterStringWithNoDefault: string; 1133 - }; 1134 - 1135 - export type CallWithNoContentResponseResponse = void; 1136 - 1137 - export type CallWithResponseAndNoContentResponseResponse = number | void; 1138 - 1139 - export type DummyAResponse = _400; 1140 - 1141 - export type DummyBResponse = void; 1142 - 1143 - export type CallWithResponseResponse = _import; 1144 - 1145 - export type CallWithDuplicateResponsesResponse = ModelWithBoolean & ModelWithInteger | ModelWithString; 1146 - 1147 - export type CallWithResponsesResponse = { 1148 - readonly '@namespace.string'?: string; 1149 - readonly '@namespace.integer'?: number; 1150 - readonly value?: Array<ModelWithString>; 1151 - } | ModelThatExtends | ModelThatExtendsExtends; 1152 - 1153 - export type CollectionFormatData = { 1154 - /** 1155 - * This is an array parameter that is sent as csv format (comma-separated values) 1156 - */ 1157 - parameterArrayCsv: Array<(string)> | null; 1158 - /** 1159 - * This is an array parameter that is sent as multi format (multiple parameter instances) 1160 - */ 1161 - parameterArrayMulti: Array<(string)> | null; 1162 - /** 1163 - * This is an array parameter that is sent as pipes format (pipe-separated values) 1164 - */ 1165 - parameterArrayPipes: Array<(string)> | null; 1166 - /** 1167 - * This is an array parameter that is sent as ssv format (space-separated values) 1168 - */ 1169 - parameterArraySsv: Array<(string)> | null; 1170 - /** 1171 - * This is an array parameter that is sent as tsv format (tab-separated values) 1172 - */ 1173 - parameterArrayTsv: Array<(string)> | null; 1174 - }; 1175 - 1176 - export type TypesData = { 1177 - /** 1178 - * This is a number parameter 1179 - */ 1180 - id?: number; 1181 - /** 1182 - * This is an array parameter 1183 - */ 1184 - parameterArray: Array<(string)> | null; 1185 - /** 1186 - * This is a boolean parameter 1187 - */ 1188 - parameterBoolean: boolean | null; 1189 - /** 1190 - * This is a dictionary parameter 1191 - */ 1192 - parameterDictionary: { 1193 - [key: string]: unknown; 1194 - } | null; 1195 - /** 1196 - * This is an enum parameter 1197 - */ 1198 - parameterEnum: 'Success' | 'Warning' | 'Error' | null; 1199 - /** 1200 - * This is a number parameter 1201 - */ 1202 - parameterNumber: number; 1203 - /** 1204 - * This is an object parameter 1205 - */ 1206 - parameterObject: { 1207 - [key: string]: unknown; 1208 - } | null; 1209 - /** 1210 - * This is a string parameter 1211 - */ 1212 - parameterString: string | null; 1213 - }; 1214 - 1215 - export type TypesResponse = number | string | boolean | { 1216 - [key: string]: unknown; 1217 - }; 1218 - 1219 - export type UploadFileData = { 1220 - formData: (Blob | File); 1221 - }; 1222 - 1223 - export type UploadFileResponse = boolean; 1224 - 1225 - export type FileResponseData = { 1226 - id: string; 1227 - }; 1228 - 1229 - export type FileResponseResponse = (Blob | File); 1230 - 1231 - export type ComplexTypesData = { 1232 - /** 1233 - * Parameter containing object 1234 - */ 1235 - parameterObject: { 1236 - first?: { 1237 - second?: { 1238 - third?: string; 1239 - }; 1240 - }; 1241 - }; 1242 - /** 1243 - * Parameter containing reference 1244 - */ 1245 - parameterReference: ModelWithString; 1246 - }; 1247 - 1248 - export type ComplexTypesResponse = Array<ModelWithString>; 1249 - 1250 - export type MultipartRequestData = { 1251 - formData?: { 1252 - content?: (Blob | File); 1253 - data?: ModelWithString | null; 1254 - }; 1255 - }; 1256 - 1257 - export type MultipartResponseResponse = { 1258 - file?: (Blob | File); 1259 - metadata?: { 1260 - foo?: string; 1261 - bar?: string; 1262 - }; 1263 - }; 1264 - 1265 - export type ComplexParamsData = { 1266 - id: number; 1267 - requestBody?: { 1268 - readonly key: string | null; 1269 - name: string | null; 1270 - enabled?: boolean; 1271 - readonly type: 'Monkey' | 'Horse' | 'Bird'; 1272 - listOfModels?: Array<ModelWithString> | null; 1273 - listOfStrings?: Array<(string)> | null; 1274 - parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 1275 - readonly user?: { 1276 - readonly id?: number; 1277 - readonly name?: string | null; 1278 - }; 1279 - }; 1280 - }; 1281 - 1282 - export type ComplexParamsResponse = ModelWithString; 1283 - 1284 - export type CallWithResultFromHeaderResponse = string; 1285 - 1286 - export type TestErrorCodeData = { 1287 - /** 1288 - * Status code to return 1289 - */ 1290 - status: number; 1291 - }; 1292 - 1293 - export type TestErrorCodeResponse = unknown; 1294 - 1295 - export type NonAsciiæøåÆøÅöôêÊ字符串Data = { 1296 - /** 1297 - * Dummy input param 1298 - */ 1299 - nonAsciiParamæøåÆøÅöôêÊ: number; 1300 - }; 1301 - 1302 - export type NonAsciiæøåÆøÅöôêÊ字符串Response = Array<NonAsciiStringæøåÆØÅöôêÊ字符串>; 1303 - 1304 - export type PutWithFormUrlEncodedData = { 1305 - formData: ArrayWithStrings; 1306 - }; 885 + export type Parameterx_Foo_Bar = ModelWithString;