Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/gold-dolls-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hey-api/openapi-ts": patch
---

**plugin(@hey-api/client-next)**: fix: improve params helper type
5 changes: 5 additions & 0 deletions .changeset/grumpy-dancers-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hey-api/openapi-ts": patch
---

**plugin(@hey-api/client-ofetch)**: fix: improve params helper type
5 changes: 5 additions & 0 deletions .changeset/rich-forks-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hey-api/openapi-ts": patch
---

**plugin(@hey-api/client-ky)**: fix: improve params helper type
5 changes: 5 additions & 0 deletions .changeset/ripe-berries-feel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hey-api/openapi-ts": patch
---

**plugin(@hey-api/client-nuxt)**: fix: improve params helper type
5 changes: 5 additions & 0 deletions .changeset/rotten-flies-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hey-api/openapi-ts": patch
---

**plugin(@hey-api/client-angular)**: fix: improve params helper type
5 changes: 5 additions & 0 deletions .changeset/shaggy-olives-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hey-api/openapi-ts": patch
---

**plugin(@hey-api/client-fetch)**: fix: improve params helper type
5 changes: 5 additions & 0 deletions .changeset/tall-insects-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hey-api/openapi-ts": patch
---

**plugin(@hey-api/client-axios)**: fix: improve params helper type
18 changes: 10 additions & 8 deletions examples/openapi-ts-angular-common/src/client/core/params.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type KeyMap = Map<
}
>;

const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
function buildKeyMap(fields: FieldsConfig, map?: KeyMap): KeyMap {
if (!map) {
map = new Map();
}
Expand All @@ -85,7 +85,7 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
}

return map;
};
}

interface Params {
body: unknown;
Expand All @@ -94,16 +94,18 @@ interface Params {
query: Record<string, unknown>;
}

const stripEmptySlots = (params: Params) => {
type ParamsSlotMap = Record<Slot, unknown>;

function stripEmptySlots(params: ParamsSlotMap): void {
for (const [slot, value] of Object.entries(params)) {
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
delete params[slot as Slot];
}
}
};
}

export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
const params: Params = {
export function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params {
const params: ParamsSlotMap = {
body: Object.create(null),
headers: Object.create(null),
path: Object.create(null),
Expand Down Expand Up @@ -165,5 +167,5 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo

stripEmptySlots(params);

return params;
};
return params as Params;
}
18 changes: 10 additions & 8 deletions examples/openapi-ts-angular/src/client/core/params.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type KeyMap = Map<
}
>;

const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
function buildKeyMap(fields: FieldsConfig, map?: KeyMap): KeyMap {
if (!map) {
map = new Map();
}
Expand All @@ -85,7 +85,7 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
}

return map;
};
}

interface Params {
body: unknown;
Expand All @@ -94,16 +94,18 @@ interface Params {
query: Record<string, unknown>;
}

const stripEmptySlots = (params: Params) => {
type ParamsSlotMap = Record<Slot, unknown>;

function stripEmptySlots(params: ParamsSlotMap): void {
for (const [slot, value] of Object.entries(params)) {
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
delete params[slot as Slot];
}
}
};
}

export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
const params: Params = {
export function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params {
const params: ParamsSlotMap = {
body: Object.create(null),
headers: Object.create(null),
path: Object.create(null),
Expand Down Expand Up @@ -165,5 +167,5 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo

stripEmptySlots(params);

return params;
};
return params as Params;
}
18 changes: 10 additions & 8 deletions examples/openapi-ts-axios/src/client/core/params.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type KeyMap = Map<
}
>;

const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
function buildKeyMap(fields: FieldsConfig, map?: KeyMap): KeyMap {
if (!map) {
map = new Map();
}
Expand All @@ -85,7 +85,7 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
}

return map;
};
}

interface Params {
body: unknown;
Expand All @@ -94,16 +94,18 @@ interface Params {
query: Record<string, unknown>;
}

const stripEmptySlots = (params: Params) => {
type ParamsSlotMap = Record<Slot, unknown>;

function stripEmptySlots(params: ParamsSlotMap): void {
for (const [slot, value] of Object.entries(params)) {
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
delete params[slot as Slot];
}
}
};
}

export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
const params: Params = {
export function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params {
const params: ParamsSlotMap = {
body: Object.create(null),
headers: Object.create(null),
path: Object.create(null),
Expand Down Expand Up @@ -165,5 +167,5 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo

stripEmptySlots(params);

return params;
};
return params as Params;
}
18 changes: 10 additions & 8 deletions examples/openapi-ts-fastify/src/client/core/params.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type KeyMap = Map<
}
>;

const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
function buildKeyMap(fields: FieldsConfig, map?: KeyMap): KeyMap {
if (!map) {
map = new Map();
}
Expand All @@ -85,7 +85,7 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
}

return map;
};
}

interface Params {
body: unknown;
Expand All @@ -94,16 +94,18 @@ interface Params {
query: Record<string, unknown>;
}

const stripEmptySlots = (params: Params) => {
type ParamsSlotMap = Record<Slot, unknown>;

function stripEmptySlots(params: ParamsSlotMap): void {
for (const [slot, value] of Object.entries(params)) {
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
delete params[slot as Slot];
}
}
};
}

export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
const params: Params = {
export function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params {
const params: ParamsSlotMap = {
body: Object.create(null),
headers: Object.create(null),
path: Object.create(null),
Expand Down Expand Up @@ -165,5 +167,5 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo

stripEmptySlots(params);

return params;
};
return params as Params;
}
18 changes: 10 additions & 8 deletions examples/openapi-ts-fetch/src/client/core/params.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type KeyMap = Map<
}
>;

const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
function buildKeyMap(fields: FieldsConfig, map?: KeyMap): KeyMap {
if (!map) {
map = new Map();
}
Expand All @@ -85,7 +85,7 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
}

return map;
};
}

interface Params {
body: unknown;
Expand All @@ -94,16 +94,18 @@ interface Params {
query: Record<string, unknown>;
}

const stripEmptySlots = (params: Params) => {
type ParamsSlotMap = Record<Slot, unknown>;

function stripEmptySlots(params: ParamsSlotMap): void {
for (const [slot, value] of Object.entries(params)) {
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
delete params[slot as Slot];
}
}
};
}

export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
const params: Params = {
export function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params {
const params: ParamsSlotMap = {
body: Object.create(null),
headers: Object.create(null),
path: Object.create(null),
Expand Down Expand Up @@ -165,5 +167,5 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo

stripEmptySlots(params);

return params;
};
return params as Params;
}
18 changes: 10 additions & 8 deletions examples/openapi-ts-ky/src/client/core/params.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type KeyMap = Map<
}
>;

const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
function buildKeyMap(fields: FieldsConfig, map?: KeyMap): KeyMap {
if (!map) {
map = new Map();
}
Expand All @@ -85,7 +85,7 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
}

return map;
};
}

interface Params {
body: unknown;
Expand All @@ -94,16 +94,18 @@ interface Params {
query: Record<string, unknown>;
}

const stripEmptySlots = (params: Params) => {
type ParamsSlotMap = Record<Slot, unknown>;

function stripEmptySlots(params: ParamsSlotMap): void {
for (const [slot, value] of Object.entries(params)) {
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
delete params[slot as Slot];
}
}
};
}

export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
const params: Params = {
export function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params {
const params: ParamsSlotMap = {
body: Object.create(null),
headers: Object.create(null),
path: Object.create(null),
Expand Down Expand Up @@ -165,5 +167,5 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo

stripEmptySlots(params);

return params;
};
return params as Params;
}
18 changes: 10 additions & 8 deletions examples/openapi-ts-nestjs/src/client/core/params.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type KeyMap = Map<
}
>;

const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
function buildKeyMap(fields: FieldsConfig, map?: KeyMap): KeyMap {
if (!map) {
map = new Map();
}
Expand All @@ -85,7 +85,7 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
}

return map;
};
}

interface Params {
body: unknown;
Expand All @@ -94,16 +94,18 @@ interface Params {
query: Record<string, unknown>;
}

const stripEmptySlots = (params: Params) => {
type ParamsSlotMap = Record<Slot, unknown>;

function stripEmptySlots(params: ParamsSlotMap): void {
for (const [slot, value] of Object.entries(params)) {
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
delete params[slot as Slot];
}
}
};
}

export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
const params: Params = {
export function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params {
const params: ParamsSlotMap = {
body: Object.create(null),
headers: Object.create(null),
path: Object.create(null),
Expand Down Expand Up @@ -165,5 +167,5 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo

stripEmptySlots(params);

return params;
};
return params as Params;
}
Loading
Loading