Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,20 @@
};

interface Params {
body: unknown;
body?: unknown;
headers: Record<string, unknown>;
path: Record<string, unknown>;
query: Record<string, unknown>;
}

const stripEmptySlots = (params: Params) => {
for (const [slot, value] of Object.entries(params)) {
if (value && typeof value === 'object' && !Object.keys(value).length) {
if (
slot !== 'body' &&
value &&
typeof value === 'object' &&
!Object.keys(value).length
) {
delete params[slot as Slot];
}
}
Expand All @@ -105,7 +110,6 @@
fields: FieldsConfig,
) => {
const params: Params = {
body: {},
headers: {},
path: {},
query: {},
Expand All @@ -126,7 +130,7 @@

if ('in' in config) {
if (config.key) {
const field = map.get(config.key)!;

Check failure on line 133 in packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/params.ts

View workflow job for this annotation

GitHub Actions / Upload

[@hey-api/openapi-ts] src/plugins/@hey-api/client-core/__tests__/params.test.ts > buildClientParams > 'positional mapped arguments'

TypeError: Cannot set properties of undefined (setting 'q_u_x') ❯ buildClientParams src/plugins/@hey-api/client-core/bundle/params.ts:133:61 ❯ src/plugins/@hey-api/client-core/__tests__/params.test.ts:350:12 ❯ new ZoneAwarePromise ../../node_modules/.pnpm/zone.js@0.16.0/node_modules/zone.js/fesm2015/zone.js:2221:23

Check failure on line 133 in packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/params.ts

View workflow job for this annotation

GitHub Actions / Upload

[@hey-api/openapi-ts] src/plugins/@hey-api/client-core/__tests__/params.test.ts > buildClientParams > 'positional arguments'

TypeError: Cannot set properties of undefined (setting 'qux') ❯ buildClientParams src/plugins/@hey-api/client-core/bundle/params.ts:133:61 ❯ src/plugins/@hey-api/client-core/__tests__/params.test.ts:350:12 ❯ new ZoneAwarePromise ../../node_modules/.pnpm/zone.js@0.16.0/node_modules/zone.js/fesm2015/zone.js:2221:23
const name = field.map || config.key;
if (field.in) {
(params[field.in] as Record<string, unknown>)[name] = arg;
Expand All @@ -138,7 +142,7 @@
for (const [key, value] of Object.entries(arg ?? {})) {
const field = map.get(key);

if (field) {

Check failure on line 145 in packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/params.ts

View workflow job for this annotation

GitHub Actions / Upload

[@hey-api/openapi-ts] src/plugins/@hey-api/client-core/__tests__/params.test.ts > buildClientParams > 'mixed arguments'

TypeError: Cannot set properties of undefined (setting 'qux') ❯ buildClientParams src/plugins/@hey-api/client-core/bundle/params.ts:145:63 ❯ src/plugins/@hey-api/client-core/__tests__/params.test.ts:350:12 ❯ new ZoneAwarePromise ../../node_modules/.pnpm/zone.js@0.16.0/node_modules/zone.js/fesm2015/zone.js:2221:23

Check failure on line 145 in packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/params.ts

View workflow job for this annotation

GitHub Actions / Upload

[@hey-api/openapi-ts] src/plugins/@hey-api/client-core/__tests__/params.test.ts > buildClientParams > 'flat arguments'

TypeError: Cannot set properties of undefined (setting 'qux') ❯ buildClientParams src/plugins/@hey-api/client-core/bundle/params.ts:145:63 ❯ src/plugins/@hey-api/client-core/__tests__/params.test.ts:350:12 ❯ new ZoneAwarePromise ../../node_modules/.pnpm/zone.js@0.16.0/node_modules/zone.js/fesm2015/zone.js:2221:23
if (field.in) {
const name = field.map || key;
(params[field.in] as Record<string, unknown>)[name] = value;
Expand Down
Loading