Skip to content

Commit 714e8f9

Browse files
committed
chore: stub old imports
1 parent 7646db7 commit 714e8f9

File tree

7 files changed

+39
-118
lines changed

7 files changed

+39
-118
lines changed

packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3-
export const useCallWithParametersMutation = async (params: {
4-
query: unknown;
5-
path: unknown;
6-
headers: unknown;
7-
body: unknown;
8-
cookies: export const _400Schema = {
9-
description: 'Model with number-only name',
10-
type: 'string'
11-
} as const;
3+
export const _400Schema = {
4+
description: 'Model with number-only name',
5+
type: 'string'
6+
} as const;
127

138
export const camelCaseCommentWithBreaksSchema = {
149
description: `Testing multiline comments in string: First line

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/schemas/default/schemas.gen.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3-
export const useCallWithParametersMutation = async (params: {
4-
query: unknown;
5-
path: unknown;
6-
headers: unknown;
7-
body: unknown;
8-
cookies: export const _400Schema = {
9-
description: 'Model with number-only name',
10-
type: 'string'
11-
} as const;
3+
export const _400Schema = {
4+
description: 'Model with number-only name',
5+
type: 'string'
6+
} as const;
127

138
export const camelCaseCommentWithBreaksSchema = {
149
description: `Testing multiline comments in string: First line

packages/openapi-ts-tests/main/test/plugins.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ for (const version of versions) {
523523
},
524524
];
525525

526-
it.only.each(scenarios)('$description', async ({ config }) => {
526+
it.each(scenarios)('$description', async ({ config }) => {
527527
await createClient(config);
528528

529529
const outputPath =

packages/openapi-ts/src/plugins/@pinia/colada/config.ts

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -11,91 +11,13 @@ export const defaultConfig: PiniaColadaPlugin['Config'] = {
1111
importPath: '@pinia/colada',
1212
includeTypes: true,
1313
prefixUse: true,
14-
resolveQuery: undefined,
15-
resolveQueryKey: undefined,
1614
suffixQueryMutation: true,
1715
useInfiniteQueries: false,
1816
},
1917
dependencies: ['@hey-api/typescript'],
2018
handler: handler as PiniaColadaPlugin['Handler'],
2119
name: '@pinia/colada',
2220
output: '@pinia/colada',
23-
resolveConfig: (plugin, context) => {
24-
// plugin.config.infiniteQueryKeys = context.valueToObject({
25-
// defaultValue: {
26-
// case: plugin.config.case ?? 'camelCase',
27-
// enabled: true,
28-
// name: '{{name}}InfiniteQueryKey',
29-
// tags: false,
30-
// },
31-
// mappers: {
32-
// boolean: (enabled) => ({ enabled }),
33-
// function: (name) => ({ name }),
34-
// string: (name) => ({ name }),
35-
// },
36-
// value: plugin.config.infiniteQueryKeys,
37-
// });
38-
39-
// plugin.config.infiniteQueryOptions = context.valueToObject({
40-
// defaultValue: {
41-
// case: plugin.config.case ?? 'camelCase',
42-
// enabled: true,
43-
// meta: false,
44-
// name: '{{name}}InfiniteOptions',
45-
// },
46-
// mappers: {
47-
// boolean: (enabled) => ({ enabled }),
48-
// function: (name) => ({ name }),
49-
// string: (name) => ({ name }),
50-
// },
51-
// value: plugin.config.infiniteQueryOptions,
52-
// });
53-
54-
// plugin.config.mutationOptions = context.valueToObject({
55-
// defaultValue: {
56-
// case: plugin.config.case ?? 'camelCase',
57-
// enabled: true,
58-
// meta: false,
59-
// name: '{{name}}Mutation',
60-
// },
61-
// mappers: {
62-
// boolean: (enabled) => ({ enabled }),
63-
// function: (name) => ({ name }),
64-
// string: (name) => ({ name }),
65-
// },
66-
// value: plugin.config.mutationOptions,
67-
// });
68-
69-
// plugin.config.queryKeys = context.valueToObject({
70-
// defaultValue: {
71-
// case: plugin.config.case ?? 'camelCase',
72-
// enabled: true,
73-
// name: '{{name}}QueryKey',
74-
// tags: false,
75-
// },
76-
// mappers: {
77-
// boolean: (enabled) => ({ enabled }),
78-
// function: (name) => ({ name }),
79-
// string: (name) => ({ name }),
80-
// },
81-
// value: plugin.config.queryKeys,
82-
// });
83-
84-
// plugin.config.queryOptions = context.valueToObject({
85-
// defaultValue: {
86-
// case: plugin.config.case ?? 'camelCase',
87-
// enabled: true,
88-
// meta: false,
89-
// name: '{{name}}Options',
90-
// },
91-
// mappers: {
92-
// boolean: (enabled) => ({ enabled }),
93-
// function: (name) => ({ name }),
94-
// string: (name) => ({ name }),
95-
// },
96-
// value: plugin.config.queryOptions,
97-
// });
98-
},
9921
};
10022

10123
/**

packages/openapi-ts/src/plugins/@pinia/colada/mutation.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ export const createMutationFunction = ({
1818
plugin: PiniaColadaPlugin['Instance'];
1919
}) => {
2020
// Allow hooks to customize or skip mutation generation
21-
if (plugin.config.onMutation && plugin.config.onMutation(operation) === false) {
21+
if (
22+
plugin.config.onMutation &&
23+
plugin.config.onMutation(operation) === false
24+
) {
2225
return;
2326
}
2427

packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,25 @@ export const handler: PiniaColadaPlugin['Handler'] = ({ plugin }) => {
4141
if (isQuery(operation, plugin)) {
4242
createQueryFunction({ context: plugin.context, file, operation, plugin });
4343
} else {
44-
createMutationFunction({ context: plugin.context, file, operation, plugin });
44+
createMutationFunction({
45+
context: plugin.context,
46+
file,
47+
operation,
48+
plugin,
49+
});
4550
}
46-
})
51+
});
4752

4853
// Add client import to all generated files
4954
Object.entries(plugin.context.files).forEach(([fileId, file]) => {
5055
if (fileId.startsWith(plugin.name)) {
5156
// Make sure we have a client import
5257
file.import({
5358
alias: '_heyApiClient',
54-
module: file.relativePathToFile({ context: plugin.context, id: clientId }),
59+
module: file.relativePathToFile({
60+
context: plugin.context,
61+
id: clientId,
62+
}),
5563
name: 'client',
5664
});
5765
}

packages/openapi-ts/src/plugins/@pinia/colada/utils.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,24 @@ import type { TypeNode } from 'typescript';
22

33
import type { GeneratedFile } from '../../../generate/file';
44
import type { IR } from '../../../ir/types';
5-
import type { Property} from '../../../tsc';
5+
import type { Property } from '../../../tsc';
66
import { tsc } from '../../../tsc';
77
import { escapeComment } from '../../../utils/escape';
88
import { stringCase } from '../../../utils/stringCase';
99
import { irParametersToIrSchema } from '../../@hey-api/typescript/operation';
10-
import {
11-
schemaToType,
12-
} from '../../@hey-api/typescript/plugin';
13-
import {
14-
importIdentifierData,
15-
importIdentifierError,
16-
importIdentifierResponse,
17-
} from '../../@hey-api/typescript/ref';
10+
import { schemaToType } from '../../@hey-api/typescript/plugin';
1811
import type { PiniaColadaPlugin } from './types';
1912

13+
const importIdentifierData = () => ({
14+
name: '',
15+
});
16+
const importIdentifierError = () => ({
17+
name: '',
18+
});
19+
const importIdentifierResponse = () => ({
20+
name: '',
21+
});
22+
2023
/**
2124
* Determines if an operation should be a query or mutation
2225
*/
@@ -182,7 +185,6 @@ function getParameterQualifiedName(name: ParamNames) {
182185
* Creates a composable function for an operation
183186
*/
184187
export const createComposable = ({
185-
context,
186188
file,
187189
isQuery,
188190
operation,
@@ -216,13 +218,9 @@ export const createComposable = ({
216218
];
217219

218220
// Get identifiers for data, response and error types
219-
const identifierData = importIdentifierData({ context, file, operation });
220-
const identifierResponse = importIdentifierResponse({
221-
context,
222-
file,
223-
operation,
224-
});
225-
const identifierError = importIdentifierError({ context, file, operation });
221+
const identifierData = importIdentifierData();
222+
const identifierResponse = importIdentifierResponse();
223+
const identifierError = importIdentifierError();
226224

227225
/**
228226
* Creates a parameter for a composable function

0 commit comments

Comments
 (0)