Skip to content

Commit 48c4d0c

Browse files
committed
test: update snapshots
1 parent 0ecfb41 commit 48c4d0c

File tree

351 files changed

+1824
-429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

351 files changed

+1824
-429
lines changed

packages/custom-client/src/plugin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import {
33
clientDefaultConfig,
44
clientDefaultMeta,
55
clientPluginHandler,
6+
type DefinePlugin,
67
definePluginConfig,
7-
type Plugin,
88
} from '@hey-api/openapi-ts';
99

1010
export type Config = Client.Config & {
@@ -14,13 +14,15 @@ export type Config = Client.Config & {
1414
name: '@hey-api/custom-client';
1515
};
1616

17-
export const defaultConfig: Plugin.Config<Config> = {
17+
export type CustomClientPlugin = DefinePlugin<Config>;
18+
19+
export const defaultConfig: CustomClientPlugin['Config'] = {
1820
...clientDefaultMeta,
1921
config: {
2022
...clientDefaultConfig,
2123
bundle: false,
2224
},
23-
handler: clientPluginHandler,
25+
handler: clientPluginHandler as unknown as CustomClientPlugin['Handler'],
2426
name: '@hey-api/custom-client',
2527
};
2628

packages/openapi-ts-tests/test/__snapshots__/2.0.x/body-response-text-plain/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/body-response-text-plain/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

packages/openapi-ts-tests/test/__snapshots__/2.0.x/form-data/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/form-data/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/valibot.gen.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export const vBar = v.object({
1414

1515
export const vPostFooData = v.object({
1616
body: v.optional(v.never()),
17-
headers: v.optional(v.never()),
1817
path: v.optional(v.never()),
1918
query: v.optional(v.never())
2019
});

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/sdk.gen.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import type { Options as ClientOptions, TDataShape, Client } from './client';
44
import type { PostFooData, PostFooResponses } from './types.gen';
5+
import { zPostFooData, zPostFooResponse } from './zod.gen';
56
import { postFooResponseTransformer } from './transformers.gen';
6-
import { zPostFooResponse } from './zod.gen';
77
import { client as _heyApiClient } from './client.gen';
88

99
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
@@ -22,6 +22,9 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
2222

2323
export const postFoo = <ThrowOnError extends boolean = false>(options?: Options<PostFooData, ThrowOnError>) => {
2424
return (options?.client ?? _heyApiClient).post<PostFooResponses, unknown, ThrowOnError>({
25+
requestValidator: async (data) => {
26+
return await zPostFooData.parseAsync(data);
27+
},
2528
responseTransformer: postFooResponseTransformer,
2629
responseValidator: async (data) => {
2730
return await zPostFooResponse.parseAsync(data);

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/zod.gen.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export const zBar = z.object({
1414

1515
export const zPostFooData = z.object({
1616
body: z.never().optional(),
17-
headers: z.never().optional(),
1817
path: z.never().optional(),
1918
query: z.never().optional()
2019
});

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/read-write-only-custom-name/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/read-write-only-custom-name/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/read-write-only-ignore/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/read-write-only-ignore/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/sdk.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,13 @@ export const collectionFormat = <ThrowOnError extends boolean = false>(options:
228228

229229
export const types = <ThrowOnError extends boolean = false>(options: Options<TypesData, ThrowOnError>) => {
230230
return (options.client ?? _heyApiClient).get<TypesResponses, unknown, ThrowOnError>({
231-
responseType: 'json',
232231
querySerializer: {
233232
array: {
234233
explode: false,
235234
style: 'form'
236235
}
237236
},
237+
responseType: 'json',
238238
url: '/api/v{api-version}/types',
239239
...options
240240
});

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export const createClient = (config: Config = {}): Client => {
4646
});
4747
}
4848

49+
if (opts.requestValidator) {
50+
await opts.requestValidator(opts);
51+
}
52+
4953
if (opts.body && opts.bodySerializer) {
5054
opts.body = opts.bodySerializer(opts.body);
5155
}

packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export interface Config {
8484
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585
*/
8686
querySerializer?: QuerySerializer | QuerySerializerOptions;
87+
/**
88+
* A function validating request data. This is useful if you want to ensure
89+
* the request conforms to the desired shape, so it can be safely sent to
90+
* the server.
91+
*/
92+
requestValidator?: (data: unknown) => Promise<unknown>;
8793
/**
8894
* A function transforming response data before it's returned. This is useful
8995
* for post-processing data, e.g. converting ISO strings into Date objects.

0 commit comments

Comments
 (0)