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

test: update examples

Lubos 016be62c 31e44a4e

+490 -164
+1 -1
examples/openapi-ts-angular-common/src/client/client/types.gen.ts
··· 253 253 RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 254 254 'body' | 'path' | 'query' | 'url' 255 255 > & 256 - Omit<TData, 'url'>; 256 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 257 257 258 258 export type OptionsLegacyParser< 259 259 TData = unknown,
+34 -11
examples/openapi-ts-angular-common/src/client/core/params.gen.ts
··· 22 22 */ 23 23 key?: string; 24 24 map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 25 36 }; 26 37 27 38 export interface Fields { ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot; 46 - map?: string; 47 - } 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 48 63 >; 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map, 61 76 }); 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map); 65 84 } ··· 111 130 if (config.key) { 112 131 const field = map.get(config.key)!; 113 132 const name = field.map || config.key; 114 - (params[field.in] as Record<string, unknown>)[name] = arg; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 115 136 } else { 116 137 params.body = arg; 117 138 } ··· 120 141 const field = map.get(key); 121 142 122 143 if (field) { 123 - const name = field.map || key; 124 - (params[field.in] as Record<string, unknown>)[name] = value; 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 125 150 } else { 126 151 const extra = extraPrefixes.find(([prefix]) => 127 152 key.startsWith(prefix), ··· 132 157 (params[slot] as Record<string, unknown>)[ 133 158 key.slice(prefix.length) 134 159 ] = value; 135 - } else { 136 - for (const [slot, allowed] of Object.entries( 137 - config.allowExtra ?? {}, 138 - )) { 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 139 162 if (allowed) { 140 163 (params[slot as Slot] as Record<string, unknown>)[key] = value; 141 164 break;
+1 -1
examples/openapi-ts-angular/src/client/client/types.gen.ts
··· 253 253 RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 254 254 'body' | 'path' | 'query' | 'url' 255 255 > & 256 - Omit<TData, 'url'>; 256 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 257 257 258 258 export type OptionsLegacyParser< 259 259 TData = unknown,
+34 -11
examples/openapi-ts-angular/src/client/core/params.gen.ts
··· 22 22 */ 23 23 key?: string; 24 24 map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 25 36 }; 26 37 27 38 export interface Fields { ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot; 46 - map?: string; 47 - } 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 48 63 >; 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map, 61 76 }); 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map); 65 84 } ··· 111 130 if (config.key) { 112 131 const field = map.get(config.key)!; 113 132 const name = field.map || config.key; 114 - (params[field.in] as Record<string, unknown>)[name] = arg; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 115 136 } else { 116 137 params.body = arg; 117 138 } ··· 120 141 const field = map.get(key); 121 142 122 143 if (field) { 123 - const name = field.map || key; 124 - (params[field.in] as Record<string, unknown>)[name] = value; 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 125 150 } else { 126 151 const extra = extraPrefixes.find(([prefix]) => 127 152 key.startsWith(prefix), ··· 132 157 (params[slot] as Record<string, unknown>)[ 133 158 key.slice(prefix.length) 134 159 ] = value; 135 - } else { 136 - for (const [slot, allowed] of Object.entries( 137 - config.allowExtra ?? {}, 138 - )) { 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 139 162 if (allowed) { 140 163 (params[slot as Slot] as Record<string, unknown>)[key] = value; 141 164 break;
+1 -1
examples/openapi-ts-axios/src/client/client/types.gen.ts
··· 194 194 RequestOptions<TResponse, ThrowOnError>, 195 195 'body' | 'path' | 'query' | 'url' 196 196 > & 197 - Omit<TData, 'url'>; 197 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 198 198 199 199 export type OptionsLegacyParser< 200 200 TData = unknown,
+34 -11
examples/openapi-ts-axios/src/client/core/params.gen.ts
··· 22 22 */ 23 23 key?: string; 24 24 map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 25 36 }; 26 37 27 38 export interface Fields { ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot; 46 - map?: string; 47 - } 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 48 63 >; 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map, 61 76 }); 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map); 65 84 } ··· 111 130 if (config.key) { 112 131 const field = map.get(config.key)!; 113 132 const name = field.map || config.key; 114 - (params[field.in] as Record<string, unknown>)[name] = arg; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 115 136 } else { 116 137 params.body = arg; 117 138 } ··· 120 141 const field = map.get(key); 121 142 122 143 if (field) { 123 - const name = field.map || key; 124 - (params[field.in] as Record<string, unknown>)[name] = value; 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 125 150 } else { 126 151 const extra = extraPrefixes.find(([prefix]) => 127 152 key.startsWith(prefix), ··· 132 157 (params[slot] as Record<string, unknown>)[ 133 158 key.slice(prefix.length) 134 159 ] = value; 135 - } else { 136 - for (const [slot, allowed] of Object.entries( 137 - config.allowExtra ?? {}, 138 - )) { 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 139 162 if (allowed) { 140 163 (params[slot as Slot] as Record<string, unknown>)[key] = value; 141 164 break;
+1 -1
examples/openapi-ts-fastify/src/client/client/types.gen.ts
··· 238 238 RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 239 239 'body' | 'path' | 'query' | 'url' 240 240 > & 241 - Omit<TData, 'url'>; 241 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 242 242 243 243 export type OptionsLegacyParser< 244 244 TData = unknown,
+34 -11
examples/openapi-ts-fastify/src/client/core/params.gen.ts
··· 22 22 */ 23 23 key?: string; 24 24 map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 25 36 }; 26 37 27 38 export interface Fields { ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot; 46 - map?: string; 47 - } 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 48 63 >; 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map, 61 76 }); 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map); 65 84 } ··· 111 130 if (config.key) { 112 131 const field = map.get(config.key)!; 113 132 const name = field.map || config.key; 114 - (params[field.in] as Record<string, unknown>)[name] = arg; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 115 136 } else { 116 137 params.body = arg; 117 138 } ··· 120 141 const field = map.get(key); 121 142 122 143 if (field) { 123 - const name = field.map || key; 124 - (params[field.in] as Record<string, unknown>)[name] = value; 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 125 150 } else { 126 151 const extra = extraPrefixes.find(([prefix]) => 127 152 key.startsWith(prefix), ··· 132 157 (params[slot] as Record<string, unknown>)[ 133 158 key.slice(prefix.length) 134 159 ] = value; 135 - } else { 136 - for (const [slot, allowed] of Object.entries( 137 - config.allowExtra ?? {}, 138 - )) { 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 139 162 if (allowed) { 140 163 (params[slot as Slot] as Record<string, unknown>)[key] = value; 141 164 break;
+1 -1
examples/openapi-ts-fetch/src/client/client/types.gen.ts
··· 238 238 RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 239 239 'body' | 'path' | 'query' | 'url' 240 240 > & 241 - Omit<TData, 'url'>; 241 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 242 242 243 243 export type OptionsLegacyParser< 244 244 TData = unknown,
+34 -11
examples/openapi-ts-fetch/src/client/core/params.gen.ts
··· 22 22 */ 23 23 key?: string; 24 24 map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 25 36 }; 26 37 27 38 export interface Fields { ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot; 46 - map?: string; 47 - } 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 48 63 >; 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map, 61 76 }); 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map); 65 84 } ··· 111 130 if (config.key) { 112 131 const field = map.get(config.key)!; 113 132 const name = field.map || config.key; 114 - (params[field.in] as Record<string, unknown>)[name] = arg; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 115 136 } else { 116 137 params.body = arg; 117 138 } ··· 120 141 const field = map.get(key); 121 142 122 143 if (field) { 123 - const name = field.map || key; 124 - (params[field.in] as Record<string, unknown>)[name] = value; 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 125 150 } else { 126 151 const extra = extraPrefixes.find(([prefix]) => 127 152 key.startsWith(prefix), ··· 132 157 (params[slot] as Record<string, unknown>)[ 133 158 key.slice(prefix.length) 134 159 ] = value; 135 - } else { 136 - for (const [slot, allowed] of Object.entries( 137 - config.allowExtra ?? {}, 138 - )) { 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 139 162 if (allowed) { 140 163 (params[slot as Slot] as Record<string, unknown>)[key] = value; 141 164 break;
+1 -1
examples/openapi-ts-next/src/client/client/types.gen.ts
··· 195 195 RequestOptions<TResponse, ThrowOnError>, 196 196 'body' | 'path' | 'query' | 'url' 197 197 > & 198 - Omit<TData, 'url'>; 198 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 199 199 200 200 export type OptionsLegacyParser< 201 201 TData = unknown,
+34 -11
examples/openapi-ts-next/src/client/core/params.gen.ts
··· 22 22 */ 23 23 key?: string; 24 24 map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 25 36 }; 26 37 27 38 export interface Fields { ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot; 46 - map?: string; 47 - } 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 48 63 >; 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map, 61 76 }); 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map); 65 84 } ··· 111 130 if (config.key) { 112 131 const field = map.get(config.key)!; 113 132 const name = field.map || config.key; 114 - (params[field.in] as Record<string, unknown>)[name] = arg; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 115 136 } else { 116 137 params.body = arg; 117 138 } ··· 120 141 const field = map.get(key); 121 142 122 143 if (field) { 123 - const name = field.map || key; 124 - (params[field.in] as Record<string, unknown>)[name] = value; 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 125 150 } else { 126 151 const extra = extraPrefixes.find(([prefix]) => 127 152 key.startsWith(prefix), ··· 132 157 (params[slot] as Record<string, unknown>)[ 133 158 key.slice(prefix.length) 134 159 ] = value; 135 - } else { 136 - for (const [slot, allowed] of Object.entries( 137 - config.allowExtra ?? {}, 138 - )) { 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 139 162 if (allowed) { 140 163 (params[slot as Slot] as Record<string, unknown>)[key] = value; 141 164 break;
+1 -1
examples/openapi-ts-ofetch/src/client/client/types.gen.ts
··· 305 305 RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 306 306 'body' | 'path' | 'query' | 'url' 307 307 > & 308 - Omit<TData, 'url'>; 308 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 309 309 310 310 export type OptionsLegacyParser< 311 311 TData = unknown,
+34 -11
examples/openapi-ts-ofetch/src/client/core/params.gen.ts
··· 22 22 */ 23 23 key?: string; 24 24 map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 25 36 }; 26 37 27 38 export interface Fields { ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot; 46 - map?: string; 47 - } 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 48 63 >; 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map, 61 76 }); 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map); 65 84 } ··· 111 130 if (config.key) { 112 131 const field = map.get(config.key)!; 113 132 const name = field.map || config.key; 114 - (params[field.in] as Record<string, unknown>)[name] = arg; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 115 136 } else { 116 137 params.body = arg; 117 138 } ··· 120 141 const field = map.get(key); 121 142 122 143 if (field) { 123 - const name = field.map || key; 124 - (params[field.in] as Record<string, unknown>)[name] = value; 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 125 150 } else { 126 151 const extra = extraPrefixes.find(([prefix]) => 127 152 key.startsWith(prefix), ··· 132 157 (params[slot] as Record<string, unknown>)[ 133 158 key.slice(prefix.length) 134 159 ] = value; 135 - } else { 136 - for (const [slot, allowed] of Object.entries( 137 - config.allowExtra ?? {}, 138 - )) { 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 139 162 if (allowed) { 140 163 (params[slot as Slot] as Record<string, unknown>)[key] = value; 141 164 break;
+1 -1
examples/openapi-ts-openai/src/client/client/types.gen.ts
··· 238 238 RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 239 239 'body' | 'path' | 'query' | 'url' 240 240 > & 241 - Omit<TData, 'url'>; 241 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 242 242 243 243 export type OptionsLegacyParser< 244 244 TData = unknown,
+34 -11
examples/openapi-ts-openai/src/client/core/params.gen.ts
··· 22 22 */ 23 23 key?: string; 24 24 map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 25 36 }; 26 37 27 38 export interface Fields { ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot; 46 - map?: string; 47 - } 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 48 63 >; 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map, 61 76 }); 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map); 65 84 } ··· 111 130 if (config.key) { 112 131 const field = map.get(config.key)!; 113 132 const name = field.map || config.key; 114 - (params[field.in] as Record<string, unknown>)[name] = arg; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 115 136 } else { 116 137 params.body = arg; 117 138 } ··· 120 141 const field = map.get(key); 121 142 122 143 if (field) { 123 - const name = field.map || key; 124 - (params[field.in] as Record<string, unknown>)[name] = value; 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 125 150 } else { 126 151 const extra = extraPrefixes.find(([prefix]) => 127 152 key.startsWith(prefix), ··· 132 157 (params[slot] as Record<string, unknown>)[ 133 158 key.slice(prefix.length) 134 159 ] = value; 135 - } else { 136 - for (const [slot, allowed] of Object.entries( 137 - config.allowExtra ?? {}, 138 - )) { 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 139 162 if (allowed) { 140 163 (params[slot as Slot] as Record<string, unknown>)[key] = value; 141 164 break;
+1 -1
examples/openapi-ts-pinia-colada/src/client/client/types.gen.ts
··· 206 206 RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 207 207 'body' | 'path' | 'query' | 'url' 208 208 > & 209 - Omit<TData, 'url'> 209 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>) 210 210 211 211 export type OptionsLegacyParser< 212 212 TData = unknown,
+34 -9
examples/openapi-ts-pinia-colada/src/client/core/params.gen.ts
··· 23 23 key?: string 24 24 map?: string 25 25 } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot 36 + } 26 37 27 38 export interface Fields { 28 39 allowExtra?: Partial<Record<Slot, boolean>> ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot 46 - map?: string 47 - } 55 + | { 56 + in: Slot 57 + map?: string 58 + } 59 + | { 60 + in?: never 61 + map: Slot 62 + } 48 63 > 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map 61 76 }) 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map 81 + }) 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map) 65 84 } ··· 108 127 if (config.key) { 109 128 const field = map.get(config.key)! 110 129 const name = field.map || config.key 111 - ;(params[field.in] as Record<string, unknown>)[name] = arg 130 + if (field.in) { 131 + ;(params[field.in] as Record<string, unknown>)[name] = arg 132 + } 112 133 } else { 113 134 params.body = arg 114 135 } ··· 117 138 const field = map.get(key) 118 139 119 140 if (field) { 120 - const name = field.map || key 121 - ;(params[field.in] as Record<string, unknown>)[name] = value 141 + if (field.in) { 142 + const name = field.map || key 143 + ;(params[field.in] as Record<string, unknown>)[name] = value 144 + } else { 145 + params[field.map] = value 146 + } 122 147 } else { 123 148 const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)) 124 149 125 150 if (extra) { 126 151 const [prefix, slot] = extra 127 152 ;(params[slot] as Record<string, unknown>)[key.slice(prefix.length)] = value 128 - } else { 129 - for (const [slot, allowed] of Object.entries(config.allowExtra ?? {})) { 153 + } else if ('allowExtra' in config && config.allowExtra) { 154 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 130 155 if (allowed) { 131 156 ;(params[slot as Slot] as Record<string, unknown>)[key] = value 132 157 break
+1 -1
examples/openapi-ts-sample/src/client/client/types.gen.ts
··· 238 238 RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 239 239 'body' | 'path' | 'query' | 'url' 240 240 > & 241 - Omit<TData, 'url'>; 241 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 242 242 243 243 export type OptionsLegacyParser< 244 244 TData = unknown,
+34 -11
examples/openapi-ts-sample/src/client/core/params.gen.ts
··· 22 22 */ 23 23 key?: string; 24 24 map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 25 36 }; 26 37 27 38 export interface Fields { ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot; 46 - map?: string; 47 - } 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 48 63 >; 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map, 61 76 }); 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map); 65 84 } ··· 111 130 if (config.key) { 112 131 const field = map.get(config.key)!; 113 132 const name = field.map || config.key; 114 - (params[field.in] as Record<string, unknown>)[name] = arg; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 115 136 } else { 116 137 params.body = arg; 117 138 } ··· 120 141 const field = map.get(key); 121 142 122 143 if (field) { 123 - const name = field.map || key; 124 - (params[field.in] as Record<string, unknown>)[name] = value; 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 125 150 } else { 126 151 const extra = extraPrefixes.find(([prefix]) => 127 152 key.startsWith(prefix), ··· 132 157 (params[slot] as Record<string, unknown>)[ 133 158 key.slice(prefix.length) 134 159 ] = value; 135 - } else { 136 - for (const [slot, allowed] of Object.entries( 137 - config.allowExtra ?? {}, 138 - )) { 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 139 162 if (allowed) { 140 163 (params[slot as Slot] as Record<string, unknown>)[key] = value; 141 164 break;
+1 -1
examples/openapi-ts-tanstack-angular-query-experimental/src/client/client/types.gen.ts
··· 253 253 RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 254 254 'body' | 'path' | 'query' | 'url' 255 255 > & 256 - Omit<TData, 'url'>; 256 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 257 257 258 258 export type OptionsLegacyParser< 259 259 TData = unknown,
+34 -11
examples/openapi-ts-tanstack-angular-query-experimental/src/client/core/params.gen.ts
··· 22 22 */ 23 23 key?: string; 24 24 map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 25 36 }; 26 37 27 38 export interface Fields { ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot; 46 - map?: string; 47 - } 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 48 63 >; 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map, 61 76 }); 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map); 65 84 } ··· 111 130 if (config.key) { 112 131 const field = map.get(config.key)!; 113 132 const name = field.map || config.key; 114 - (params[field.in] as Record<string, unknown>)[name] = arg; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 115 136 } else { 116 137 params.body = arg; 117 138 } ··· 120 141 const field = map.get(key); 121 142 122 143 if (field) { 123 - const name = field.map || key; 124 - (params[field.in] as Record<string, unknown>)[name] = value; 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 125 150 } else { 126 151 const extra = extraPrefixes.find(([prefix]) => 127 152 key.startsWith(prefix), ··· 132 157 (params[slot] as Record<string, unknown>)[ 133 158 key.slice(prefix.length) 134 159 ] = value; 135 - } else { 136 - for (const [slot, allowed] of Object.entries( 137 - config.allowExtra ?? {}, 138 - )) { 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 139 162 if (allowed) { 140 163 (params[slot as Slot] as Record<string, unknown>)[key] = value; 141 164 break;
+1 -1
examples/openapi-ts-tanstack-react-query/src/client/client/types.gen.ts
··· 238 238 RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 239 239 'body' | 'path' | 'query' | 'url' 240 240 > & 241 - Omit<TData, 'url'>; 241 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 242 242 243 243 export type OptionsLegacyParser< 244 244 TData = unknown,
+34 -11
examples/openapi-ts-tanstack-react-query/src/client/core/params.gen.ts
··· 22 22 */ 23 23 key?: string; 24 24 map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 25 36 }; 26 37 27 38 export interface Fields { ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot; 46 - map?: string; 47 - } 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 48 63 >; 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map, 61 76 }); 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map); 65 84 } ··· 111 130 if (config.key) { 112 131 const field = map.get(config.key)!; 113 132 const name = field.map || config.key; 114 - (params[field.in] as Record<string, unknown>)[name] = arg; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 115 136 } else { 116 137 params.body = arg; 117 138 } ··· 120 141 const field = map.get(key); 121 142 122 143 if (field) { 123 - const name = field.map || key; 124 - (params[field.in] as Record<string, unknown>)[name] = value; 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 125 150 } else { 126 151 const extra = extraPrefixes.find(([prefix]) => 127 152 key.startsWith(prefix), ··· 132 157 (params[slot] as Record<string, unknown>)[ 133 158 key.slice(prefix.length) 134 159 ] = value; 135 - } else { 136 - for (const [slot, allowed] of Object.entries( 137 - config.allowExtra ?? {}, 138 - )) { 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 139 162 if (allowed) { 140 163 (params[slot as Slot] as Record<string, unknown>)[key] = value; 141 164 break;
+1 -1
examples/openapi-ts-tanstack-svelte-query/src/client/client/types.gen.ts
··· 238 238 RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 239 239 'body' | 'path' | 'query' | 'url' 240 240 > & 241 - Omit<TData, 'url'>; 241 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 242 242 243 243 export type OptionsLegacyParser< 244 244 TData = unknown,
+34 -11
examples/openapi-ts-tanstack-svelte-query/src/client/core/params.gen.ts
··· 22 22 */ 23 23 key?: string; 24 24 map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 25 36 }; 26 37 27 38 export interface Fields { ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot; 46 - map?: string; 47 - } 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 48 63 >; 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map, 61 76 }); 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map); 65 84 } ··· 111 130 if (config.key) { 112 131 const field = map.get(config.key)!; 113 132 const name = field.map || config.key; 114 - (params[field.in] as Record<string, unknown>)[name] = arg; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 115 136 } else { 116 137 params.body = arg; 117 138 } ··· 120 141 const field = map.get(key); 121 142 122 143 if (field) { 123 - const name = field.map || key; 124 - (params[field.in] as Record<string, unknown>)[name] = value; 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 125 150 } else { 126 151 const extra = extraPrefixes.find(([prefix]) => 127 152 key.startsWith(prefix), ··· 132 157 (params[slot] as Record<string, unknown>)[ 133 158 key.slice(prefix.length) 134 159 ] = value; 135 - } else { 136 - for (const [slot, allowed] of Object.entries( 137 - config.allowExtra ?? {}, 138 - )) { 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 139 162 if (allowed) { 140 163 (params[slot as Slot] as Record<string, unknown>)[key] = value; 141 164 break;
+1 -1
examples/openapi-ts-tanstack-vue-query/src/client/client/types.gen.ts
··· 206 206 RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 207 207 'body' | 'path' | 'query' | 'url' 208 208 > & 209 - Omit<TData, 'url'> 209 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>) 210 210 211 211 export type OptionsLegacyParser< 212 212 TData = unknown,
+34 -9
examples/openapi-ts-tanstack-vue-query/src/client/core/params.gen.ts
··· 23 23 key?: string 24 24 map?: string 25 25 } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot 36 + } 26 37 27 38 export interface Fields { 28 39 allowExtra?: Partial<Record<Slot, boolean>> ··· 41 52 42 53 type KeyMap = Map< 43 54 string, 44 - { 45 - in: Slot 46 - map?: string 47 - } 55 + | { 56 + in: Slot 57 + map?: string 58 + } 59 + | { 60 + in?: never 61 + map: Slot 62 + } 48 63 > 49 64 50 65 const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { ··· 60 75 map: config.map 61 76 }) 62 77 } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map 81 + }) 63 82 } else if (config.args) { 64 83 buildKeyMap(config.args, map) 65 84 } ··· 108 127 if (config.key) { 109 128 const field = map.get(config.key)! 110 129 const name = field.map || config.key 111 - ;(params[field.in] as Record<string, unknown>)[name] = arg 130 + if (field.in) { 131 + ;(params[field.in] as Record<string, unknown>)[name] = arg 132 + } 112 133 } else { 113 134 params.body = arg 114 135 } ··· 117 138 const field = map.get(key) 118 139 119 140 if (field) { 120 - const name = field.map || key 121 - ;(params[field.in] as Record<string, unknown>)[name] = value 141 + if (field.in) { 142 + const name = field.map || key 143 + ;(params[field.in] as Record<string, unknown>)[name] = value 144 + } else { 145 + params[field.map] = value 146 + } 122 147 } else { 123 148 const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)) 124 149 125 150 if (extra) { 126 151 const [prefix, slot] = extra 127 152 ;(params[slot] as Record<string, unknown>)[key.slice(prefix.length)] = value 128 - } else { 129 - for (const [slot, allowed] of Object.entries(config.allowExtra ?? {})) { 153 + } else if ('allowExtra' in config && config.allowExtra) { 154 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 130 155 if (allowed) { 131 156 ;(params[slot as Slot] as Record<string, unknown>)[key] = value 132 157 break