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.

fix: preserve empty array body in stripEmptySlots

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>

+13 -1
+12
packages/openapi-ts/src/plugins/@hey-api/client-core/__tests__/params.test.ts
··· 344 344 description: 'strip empty slots', 345 345 params: {}, 346 346 }, 347 + { 348 + args: [[]], 349 + config: [ 350 + { 351 + in: 'body', 352 + }, 353 + ], 354 + description: 'empty array body', 355 + params: { 356 + body: [], 357 + }, 358 + }, 347 359 ]; 348 360 349 361 it.each(scenarios)('$description', async ({ args, config, params }) => {
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/params.ts
··· 94 94 95 95 const stripEmptySlots = (params: Params) => { 96 96 for (const [slot, value] of Object.entries(params)) { 97 - if (value && typeof value === 'object' && !Object.keys(value).length) { 97 + if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) { 98 98 delete params[slot as Slot]; 99 99 } 100 100 }