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.

Merge pull request #3180 from hey-api/refactor/external-symbols

refactor: simplify external symbol references

authored by

Lubos and committed by
GitHub
9096fd6a 37ae25a8

+90 -262
+20 -7
packages/openapi-ts/src/plugins/@faker-js/faker/api.ts
··· 7 7 /** 8 8 * Generate a Faker expression for a schema. 9 9 * 10 - * Returns an expression that, when executed, produces a valid instance. 10 + * Returns an expression that produces a valid instance when executed. 11 + * Use when you need one-off generation without referencing shared artifacts. 12 + * 13 + * @example 14 + * ```ts 15 + * { 16 + * name: faker.person.fullName(), 17 + * email: faker.internet.email() 18 + * } 19 + * ``` 11 20 */ 12 - generateValue(schema: IR.SchemaObject): Expression; 21 + toNode(schema: IR.SchemaObject): Expression; 13 22 /** 14 - * Get a reference to an exported generator function. 23 + * Get a reference to a generated Faker expression for a schema. 24 + * 25 + * Returns a call expression referencing the shared artifact. 26 + * If the artifact doesn't exist, it will be created. 15 27 * 16 - * Returns an identifier that can be called, e.g., `fakeUser()` 28 + * @example 29 + * // Returns: fakeUser() 17 30 */ 18 - getGeneratorRef(schema: IR.SchemaObject): Expression; 31 + toNodeRef(schema: IR.SchemaObject): Expression; 19 32 }; 20 33 21 34 export class Api implements IApi { 22 35 // eslint-disable-next-line @typescript-eslint/no-unused-vars 23 - generateValue(_schema: IR.SchemaObject): Expression { 36 + toNode(_schema: IR.SchemaObject): Expression { 24 37 return undefined as any; 25 38 } 26 39 27 40 // eslint-disable-next-line @typescript-eslint/no-unused-vars 28 - getGeneratorRef(_schema: IR.SchemaObject): Expression { 41 + toNodeRef(_schema: IR.SchemaObject): Expression { 29 42 return undefined as any; 30 43 } 31 44 }
+1 -4
packages/openapi-ts/src/plugins/@hey-api/sdk/shared/class.ts
··· 74 74 }): ReturnType<typeof $.class> => { 75 75 const symClient = plugin.getSymbol({ category: 'client' }); 76 76 const optionalClient = Boolean(plugin.config.client && symClient); 77 - const symbolClient = plugin.referenceSymbol({ 78 - category: 'external', 79 - resource: 'client.Client', 80 - }); 77 + const symbolClient = plugin.external('client.Client'); 81 78 return $.class(symbol) 82 79 .field('client', (f) => f.protected().type(symbolClient)) 83 80 .newline()
+3 -12
packages/openapi-ts/src/plugins/@hey-api/sdk/shared/operation.ts
··· 254 254 if (operation.body) { 255 255 switch (operation.body.type) { 256 256 case 'form-data': { 257 - const symbol = plugin.referenceSymbol({ 258 - category: 'external', 259 - resource: 'client.formDataBodySerializer', 260 - }); 257 + const symbol = plugin.external('client.formDataBodySerializer'); 261 258 reqOptions.spread(symbol); 262 259 break; 263 260 } ··· 270 267 reqOptions.prop('bodySerializer', $.literal(null)); 271 268 break; 272 269 case 'url-search-params': { 273 - const symbol = plugin.referenceSymbol({ 274 - category: 'external', 275 - resource: 'client.urlSearchParamsBodySerializer', 276 - }); 270 + const symbol = plugin.external('client.urlSearchParamsBodySerializer'); 277 271 reqOptions.spread(symbol); 278 272 break; 279 273 } ··· 423 417 } 424 418 config.push(shape); 425 419 } 426 - const symbol = plugin.referenceSymbol({ 427 - category: 'external', 428 - resource: 'client.buildClientParams', 429 - }); 420 + const symbol = plugin.external('client.buildClientParams'); 430 421 statements.push( 431 422 $.const('params').assign( 432 423 $(symbol).call(
+1 -6
packages/openapi-ts/src/plugins/@hey-api/sdk/shared/typeOptions.ts
··· 49 49 t 50 50 .generic('TComposable', (g) => 51 51 g 52 - .extends( 53 - plugin.referenceSymbol({ 54 - category: 'external', 55 - resource: 'client.Composable', 56 - }), 57 - ) 52 + .extends(plugin.external('client.Composable')) 58 53 .default($.type.literal('$fetch')), 59 54 ) 60 55 .generic('TData', (g) =>
+3 -4
packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts
··· 16 16 operation: IR.OperationObject; 17 17 plugin: PiniaColadaPlugin['Instance']; 18 18 }): void => { 19 - const symbolMutationOptionsType = plugin.referenceSymbol({ 20 - category: 'external', 21 - resource: `${plugin.name}.UseMutationOptions`, 22 - }); 19 + const symbolMutationOptionsType = plugin.external( 20 + `${plugin.name}.UseMutationOptions`, 21 + ); 23 22 24 23 const client = getClientPlugin(plugin.context.config); 25 24 const isNuxtClient = client.name === '@hey-api/client-nuxt';
+2 -8
packages/openapi-ts/src/plugins/@pinia/colada/queryKey.ts
··· 37 37 resource: 'QueryKey', 38 38 tool: plugin.name, 39 39 }); 40 - const symbolJsonValue = plugin.referenceSymbol({ 41 - category: 'external', 42 - resource: `${plugin.name}._JSONValue`, 43 - }); 40 + const symbolJsonValue = plugin.external(`${plugin.name}._JSONValue`); 44 41 45 42 const returnType = $.type(symbolQueryKeyType).generic(TOptionsType).idx(0); 46 43 ··· 157 154 }: { 158 155 plugin: PiniaColadaPlugin['Instance']; 159 156 }) => { 160 - const symbolJsonValue = plugin.referenceSymbol({ 161 - category: 'external', 162 - resource: `${plugin.name}._JSONValue`, 163 - }); 157 + const symbolJsonValue = plugin.external(`${plugin.name}._JSONValue`); 164 158 165 159 const symbolOptions = plugin.referenceSymbol({ 166 160 category: 'type',
+3 -4
packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts
··· 137 137 }, 138 138 }, 139 139 ); 140 - const symbolDefineQueryOptions = plugin.referenceSymbol({ 141 - category: 'external', 142 - resource: `${plugin.name}.defineQueryOptions`, 143 - }); 140 + const symbolDefineQueryOptions = plugin.external( 141 + `${plugin.name}.defineQueryOptions`, 142 + ); 144 143 const statement = $.const(symbolQueryOptionsFn) 145 144 .export() 146 145 .$if(plugin.config.comments && createOperationComment(operation), (c, v) =>
+1 -4
packages/openapi-ts/src/plugins/@pinia/colada/useType.ts
··· 32 32 }); 33 33 const symbolError = symbolErrorType || 'Error'; 34 34 if (client.name === '@hey-api/client-axios') { 35 - const symbol = plugin.referenceSymbol({ 36 - category: 'external', 37 - resource: 'axios.AxiosError', 38 - }); 35 + const symbol = plugin.external('axios.AxiosError'); 39 36 return $.type(symbol).generic(symbolError); 40 37 } 41 38 return $.type(symbolError);
+2 -9
packages/openapi-ts/src/plugins/@tanstack/query-core/shared/useType.ts
··· 31 31 role: 'error', 32 32 }); 33 33 const symbolError = 34 - symbolErrorType || 35 - plugin.referenceSymbol({ 36 - category: 'external', 37 - resource: `${plugin.name}.DefaultError`, 38 - }); 34 + symbolErrorType || plugin.external(`${plugin.name}.DefaultError`); 39 35 if (client.name === '@hey-api/client-axios') { 40 - const symbol = plugin.referenceSymbol({ 41 - category: 'external', 42 - resource: 'axios.AxiosError', 43 - }); 36 + const symbol = plugin.external('axios.AxiosError'); 44 37 return $.type(symbol).generic(symbolError); 45 38 } 46 39 return $.type(symbolError);
+4 -8
packages/openapi-ts/src/plugins/@tanstack/query-core/v5/infiniteQueryOptions.ts
··· 144 144 createInfiniteParamsFunction({ plugin }); 145 145 } 146 146 147 - const symbolInfiniteQueryOptions = plugin.referenceSymbol({ 148 - category: 'external', 149 - resource: `${plugin.name}.infiniteQueryOptions`, 150 - }); 151 - const symbolInfiniteDataType = plugin.referenceSymbol({ 152 - category: 'external', 153 - resource: `${plugin.name}.InfiniteData`, 154 - }); 147 + const symbolInfiniteQueryOptions = plugin.external( 148 + `${plugin.name}.infiniteQueryOptions`, 149 + ); 150 + const symbolInfiniteDataType = plugin.external(`${plugin.name}.InfiniteData`); 155 151 156 152 const typeData = useTypeData({ operation, plugin }); 157 153 const typeResponse = useTypeResponse({ operation, plugin });
+3 -4
packages/openapi-ts/src/plugins/@tanstack/query-core/v5/mutationOptions.ts
··· 15 15 operation: IR.OperationObject; 16 16 plugin: PluginInstance; 17 17 }): void => { 18 - const symbolMutationOptionsType = plugin.referenceSymbol({ 19 - category: 'external', 20 - resource: `${plugin.name}.MutationOptions`, 21 - }); 18 + const symbolMutationOptionsType = plugin.external( 19 + `${plugin.name}.MutationOptions`, 20 + ); 22 21 23 22 const typeData = useTypeData({ operation, plugin }); 24 23 const mutationType = $.type(symbolMutationOptionsType)
+1 -4
packages/openapi-ts/src/plugins/@tanstack/query-core/v5/queryOptions.ts
··· 46 46 createQueryKeyFunction({ plugin }); 47 47 } 48 48 49 - const symbolQueryOptions = plugin.referenceSymbol({ 50 - category: 'external', 51 - resource: `${plugin.name}.queryOptions`, 52 - }); 49 + const symbolQueryOptions = plugin.external(`${plugin.name}.queryOptions`); 53 50 54 51 const symbolQueryKey = plugin.symbol( 55 52 applyNaming(operation.id, plugin.config.queryKeys),
+1 -4
packages/openapi-ts/src/plugins/@tanstack/query-core/v5/useQuery.ts
··· 31 31 applyNaming(operation.id, plugin.config.useQuery), 32 32 ); 33 33 34 - const symbolUseQuery = plugin.referenceSymbol({ 35 - category: 'external', 36 - resource: `${plugin.name}.useQuery`, 37 - }); 34 + const symbolUseQuery = plugin.external(`${plugin.name}.useQuery`); 38 35 39 36 const isRequiredOptions = isOperationOptionsRequired({ 40 37 context: plugin.context,
+1 -4
packages/openapi-ts/src/plugins/arktype/shared/export.ts
··· 21 21 symbol: Symbol; 22 22 typeInferSymbol: Symbol | undefined; 23 23 }): void => { 24 - const type = plugin.referenceSymbol({ 25 - category: 'external', 26 - resource: 'arktype.type', 27 - }); 24 + const type = plugin.external('arktype.type'); 28 25 29 26 const statement = $.const(symbol) 30 27 .export()
+1 -4
packages/openapi-ts/src/plugins/arktype/v2/toAst/index.ts
··· 85 85 // }); 86 86 } 87 87 88 - const type = args.plugin.referenceSymbol({ 89 - category: 'external', 90 - resource: 'arktype.type', 91 - }); 88 + const type = args.plugin.external('arktype.type'); 92 89 93 90 const expression = $(type).call( 94 91 $.object()
+1 -4
packages/openapi-ts/src/plugins/swr/v2/useSwr.ts
··· 20 20 return; 21 21 } 22 22 23 - const symbolUseSwr = plugin.referenceSymbol({ 24 - category: 'external', 25 - resource: 'swr', 26 - }); 23 + const symbolUseSwr = plugin.external('swr'); 27 24 const symbolUseQueryFn = plugin.symbol( 28 25 applyNaming(operation.id, plugin.config.useSwr), 29 26 );
+1 -5
packages/openapi-ts/src/plugins/valibot/shared/export.ts
··· 19 19 schema: IR.SchemaObject; 20 20 symbol: Symbol; 21 21 }): void => { 22 - const v = plugin.referenceSymbol({ 23 - category: 'external', 24 - resource: 'valibot.v', 25 - }); 26 - 22 + const v = plugin.external('valibot.v'); 27 23 const statement = $.const(symbol) 28 24 .export() 29 25 .$if(plugin.config.comments && createSchemaComment(schema), (c, v) =>
+1 -4
packages/openapi-ts/src/plugins/valibot/v1/plugin.ts
··· 36 36 pipes: [], 37 37 }; 38 38 39 - const v = plugin.referenceSymbol({ 40 - category: 'external', 41 - resource: 'valibot.v', 42 - }); 39 + const v = plugin.external('valibot.v'); 43 40 44 41 if (schema.$ref) { 45 42 const query: SymbolMeta = {
+1 -4
packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts
··· 21 21 pipes: [], 22 22 }; 23 23 24 - const v = plugin.referenceSymbol({ 25 - category: 'external', 26 - resource: 'valibot.v', 27 - }); 24 + const v = plugin.external('valibot.v'); 28 25 const functionName = $(v).attr(identifiers.schemas.array); 29 26 30 27 if (!schema.items) {
+1 -4
packages/openapi-ts/src/plugins/valibot/v1/toAst/boolean.ts
··· 13 13 }): ReturnType<typeof $.call | typeof $.expr> => { 14 14 const pipes: Array<ReturnType<typeof $.call>> = []; 15 15 16 - const v = plugin.referenceSymbol({ 17 - category: 'external', 18 - resource: 'valibot.v', 19 - }); 16 + const v = plugin.external('valibot.v'); 20 17 21 18 if (typeof schema.const === 'boolean') { 22 19 pipes.push(
+1 -4
packages/openapi-ts/src/plugins/valibot/v1/toAst/enum.ts
··· 35 35 }); 36 36 } 37 37 38 - const v = plugin.referenceSymbol({ 39 - category: 'external', 40 - resource: 'valibot.v', 41 - }); 38 + const v = plugin.external('valibot.v'); 42 39 43 40 let resultExpression = $(v) 44 41 .attr(identifiers.schemas.picklist)
+1 -4
packages/openapi-ts/src/plugins/valibot/v1/toAst/never.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'never'>; 11 11 }) => { 12 - const v = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'valibot.v', 15 - }); 12 + const v = plugin.external('valibot.v'); 16 13 const expression = $(v).attr(identifiers.schemas.never).call(); 17 14 return expression; 18 15 };
+1 -4
packages/openapi-ts/src/plugins/valibot/v1/toAst/null.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'null'>; 11 11 }) => { 12 - const v = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'valibot.v', 15 - }); 12 + const v = plugin.external('valibot.v'); 16 13 const expression = $(v).attr(identifiers.schemas.null).call(); 17 14 return expression; 18 15 };
+1 -4
packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts
··· 18 18 }): Omit<Ast, 'typeName'> => { 19 19 const result: Partial<Omit<Ast, 'typeName'>> = {}; 20 20 21 - const v = plugin.referenceSymbol({ 22 - category: 'external', 23 - resource: 'valibot.v', 24 - }); 21 + const v = plugin.external('valibot.v'); 25 22 26 23 if (schema.const && Array.isArray(schema.const)) { 27 24 const tupleElements = schema.const.map((value) =>
+1 -5
packages/openapi-ts/src/plugins/valibot/v1/toAst/undefined.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'undefined'>; 11 11 }) => { 12 - const v = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'valibot.v', 15 - }); 16 - 12 + const v = plugin.external('valibot.v'); 17 13 const expression = $(v).attr(identifiers.schemas.undefined).call(); 18 14 return expression; 19 15 };
+1 -5
packages/openapi-ts/src/plugins/valibot/v1/toAst/unknown.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'unknown'>; 11 11 }) => { 12 - const v = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'valibot.v', 15 - }); 16 - 12 + const v = plugin.external('valibot.v'); 17 13 const expression = $(v).attr(identifiers.schemas.unknown).call(); 18 14 return expression; 19 15 };
+1 -5
packages/openapi-ts/src/plugins/valibot/v1/toAst/void.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'void'>; 11 11 }) => { 12 - const v = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'valibot.v', 15 - }); 16 - 12 + const v = plugin.external('valibot.v'); 17 13 const expression = $(v).attr(identifiers.schemas.void).call(); 18 14 return expression; 19 15 };
+1 -4
packages/openapi-ts/src/plugins/zod/mini/plugin.ts
··· 34 34 }): Ast => { 35 35 let ast: Partial<Ast> = {}; 36 36 37 - const z = plugin.referenceSymbol({ 38 - category: 'external', 39 - resource: 'zod.z', 40 - }); 37 + const z = plugin.external('zod.z'); 41 38 42 39 if (schema.$ref) { 43 40 const query: SymbolMeta = {
+1 -4
packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts
··· 16 16 }: IrSchemaToAstOptions & { 17 17 schema: SchemaWithType<'array'>; 18 18 }): Omit<Ast, 'typeName'> => { 19 - const z = plugin.referenceSymbol({ 20 - category: 'external', 21 - resource: 'zod.z', 22 - }); 19 + const z = plugin.external('zod.z'); 23 20 24 21 const result: Partial<Omit<Ast, 'typeName'>> = {}; 25 22
+1 -4
packages/openapi-ts/src/plugins/zod/mini/toAst/boolean.ts
··· 13 13 const result: Partial<Omit<Ast, 'typeName'>> = {}; 14 14 let chain: ReturnType<typeof $.call>; 15 15 16 - const z = plugin.referenceSymbol({ 17 - category: 'external', 18 - resource: 'zod.z', 19 - }); 16 + const z = plugin.external('zod.z'); 20 17 21 18 if (typeof schema.const === 'boolean') { 22 19 chain = $(z).attr(identifiers.literal).call($.literal(schema.const));
+1 -4
packages/openapi-ts/src/plugins/zod/mini/toAst/enum.ts
··· 12 12 }: IrSchemaToAstOptions & { 13 13 schema: SchemaWithType<'enum'>; 14 14 }): Omit<Ast, 'typeName'> => { 15 - const z = plugin.referenceSymbol({ 16 - category: 'external', 17 - resource: 'zod.z', 18 - }); 15 + const z = plugin.external('zod.z'); 19 16 20 17 const result: Partial<Omit<Ast, 'typeName'>> = {}; 21 18
+1 -4
packages/openapi-ts/src/plugins/zod/mini/toAst/never.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'never'>; 11 11 }): Omit<Ast, 'typeName'> => { 12 - const z = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'zod.z', 15 - }); 12 + const z = plugin.external('zod.z'); 16 13 const result: Partial<Omit<Ast, 'typeName'>> = {}; 17 14 result.expression = $(z).attr(identifiers.never).call(); 18 15 return result as Omit<Ast, 'typeName'>;
+1 -4
packages/openapi-ts/src/plugins/zod/mini/toAst/null.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'null'>; 11 11 }): Omit<Ast, 'typeName'> => { 12 - const z = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'zod.z', 15 - }); 12 + const z = plugin.external('zod.z'); 16 13 const result: Partial<Omit<Ast, 'typeName'>> = {}; 17 14 result.expression = $(z).attr(identifiers.null).call(); 18 15 return result as Omit<Ast, 'typeName'>;
+1 -4
packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts
··· 14 14 }: IrSchemaToAstOptions & { 15 15 schema: SchemaWithType<'tuple'>; 16 16 }): Omit<Ast, 'typeName'> => { 17 - const z = plugin.referenceSymbol({ 18 - category: 'external', 19 - resource: 'zod.z', 20 - }); 17 + const z = plugin.external('zod.z'); 21 18 22 19 const result: Partial<Omit<Ast, 'typeName'>> = {}; 23 20
+1 -4
packages/openapi-ts/src/plugins/zod/mini/toAst/undefined.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'undefined'>; 11 11 }): Omit<Ast, 'typeName'> => { 12 - const z = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'zod.z', 15 - }); 12 + const z = plugin.external('zod.z'); 16 13 const result: Partial<Omit<Ast, 'typeName'>> = {}; 17 14 result.expression = $(z).attr(identifiers.undefined).call(); 18 15 return result as Omit<Ast, 'typeName'>;
+1 -4
packages/openapi-ts/src/plugins/zod/mini/toAst/unknown.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'unknown'>; 11 11 }): Omit<Ast, 'typeName'> => { 12 - const z = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'zod.z', 15 - }); 12 + const z = plugin.external('zod.z'); 16 13 const result: Partial<Omit<Ast, 'typeName'>> = {}; 17 14 result.expression = $(z).attr(identifiers.unknown).call(); 18 15 return result as Omit<Ast, 'typeName'>;
+1 -4
packages/openapi-ts/src/plugins/zod/mini/toAst/void.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'void'>; 11 11 }): Omit<Ast, 'typeName'> => { 12 - const z = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'zod.z', 15 - }); 12 + const z = plugin.external('zod.z'); 16 13 const result: Partial<Omit<Ast, 'typeName'>> = {}; 17 14 result.expression = $(z).attr(identifiers.void).call(); 18 15 return result as Omit<Ast, 'typeName'>;
+1 -4
packages/openapi-ts/src/plugins/zod/shared/export.ts
··· 21 21 symbol: Symbol; 22 22 typeInferSymbol: Symbol | undefined; 23 23 }): void => { 24 - const z = plugin.referenceSymbol({ 25 - category: 'external', 26 - resource: 'zod.z', 27 - }); 24 + const z = plugin.external('zod.z'); 28 25 29 26 const statement = $.const(symbol) 30 27 .export()
+1 -4
packages/openapi-ts/src/plugins/zod/v3/plugin.ts
··· 34 34 }): Ast => { 35 35 let ast: Partial<Ast> = {}; 36 36 37 - const z = plugin.referenceSymbol({ 38 - category: 'external', 39 - resource: 'zod.z', 40 - }); 37 + const z = plugin.external('zod.z'); 41 38 42 39 if (schema.$ref) { 43 40 const query: SymbolMeta = {
+1 -4
packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts
··· 18 18 }): Omit<Ast, 'typeName'> & { 19 19 anyType?: string; 20 20 } => { 21 - const z = plugin.referenceSymbol({ 22 - category: 'external', 23 - resource: 'zod.z', 24 - }); 21 + const z = plugin.external('zod.z'); 25 22 26 23 const functionName = $(z).attr(identifiers.array); 27 24
+1 -4
packages/openapi-ts/src/plugins/zod/v3/toAst/boolean.ts
··· 12 12 }): ReturnType<typeof $.call> => { 13 13 let chain: ReturnType<typeof $.call>; 14 14 15 - const z = plugin.referenceSymbol({ 16 - category: 'external', 17 - resource: 'zod.z', 18 - }); 15 + const z = plugin.external('zod.z'); 19 16 20 17 if (typeof schema.const === 'boolean') { 21 18 chain = $(z).attr(identifiers.literal).call($.literal(schema.const));
+1 -4
packages/openapi-ts/src/plugins/zod/v3/toAst/enum.ts
··· 12 12 }: IrSchemaToAstOptions & { 13 13 schema: SchemaWithType<'enum'>; 14 14 }): ReturnType<typeof $.call> => { 15 - const z = plugin.referenceSymbol({ 16 - category: 'external', 17 - resource: 'zod.z', 18 - }); 15 + const z = plugin.external('zod.z'); 19 16 20 17 const enumMembers: Array<ReturnType<typeof $.literal>> = []; 21 18 const literalMembers: Array<ReturnType<typeof $.call>> = [];
+1 -4
packages/openapi-ts/src/plugins/zod/v3/toAst/never.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'never'>; 11 11 }) => { 12 - const z = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'zod.z', 15 - }); 12 + const z = plugin.external('zod.z'); 16 13 const expression = $(z).attr(identifiers.never).call(); 17 14 return expression; 18 15 };
+1 -4
packages/openapi-ts/src/plugins/zod/v3/toAst/null.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'null'>; 11 11 }) => { 12 - const z = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'zod.z', 15 - }); 12 + const z = plugin.external('zod.z'); 16 13 const expression = $(z).attr(identifiers.null).call(); 17 14 return expression; 18 15 };
+1 -4
packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts
··· 16 16 }): Omit<Ast, 'typeName'> & { 17 17 anyType?: string; 18 18 } => { 19 - const z = plugin.referenceSymbol({ 20 - category: 'external', 21 - resource: 'zod.z', 22 - }); 19 + const z = plugin.external('zod.z'); 23 20 24 21 let hasLazyExpression = false; 25 22
+1 -4
packages/openapi-ts/src/plugins/zod/v3/toAst/undefined.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'undefined'>; 11 11 }) => { 12 - const z = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'zod.z', 15 - }); 12 + const z = plugin.external('zod.z'); 16 13 const expression = $(z).attr(identifiers.undefined).call(); 17 14 return expression; 18 15 };
+1 -4
packages/openapi-ts/src/plugins/zod/v3/toAst/unknown.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'unknown'>; 11 11 }) => { 12 - const z = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'zod.z', 15 - }); 12 + const z = plugin.external('zod.z'); 16 13 const expression = $(z).attr(identifiers.unknown).call(); 17 14 return expression; 18 15 };
+1 -4
packages/openapi-ts/src/plugins/zod/v3/toAst/void.ts
··· 9 9 }: IrSchemaToAstOptions & { 10 10 schema: SchemaWithType<'void'>; 11 11 }) => { 12 - const z = plugin.referenceSymbol({ 13 - category: 'external', 14 - resource: 'zod.z', 15 - }); 12 + const z = plugin.external('zod.z'); 16 13 const expression = $(z).attr(identifiers.void).call(); 17 14 return expression; 18 15 };
+1 -4
packages/openapi-ts/src/plugins/zod/v4/plugin.ts
··· 34 34 }): Ast => { 35 35 let ast: Partial<Ast> = {}; 36 36 37 - const z = plugin.referenceSymbol({ 38 - category: 'external', 39 - resource: 'zod.z', 40 - }); 37 + const z = plugin.external('zod.z'); 41 38 42 39 if (schema.$ref) { 43 40 const query: SymbolMeta = {
+1 -4
packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts
··· 18 18 }): Omit<Ast, 'typeName'> => { 19 19 const result: Partial<Omit<Ast, 'typeName'>> = {}; 20 20 21 - const z = plugin.referenceSymbol({ 22 - category: 'external', 23 - resource: 'zod.z', 24 - }); 21 + const z = plugin.external('zod.z'); 25 22 26 23 const functionName = $(z).attr(identifiers.array); 27 24
+1 -4
packages/openapi-ts/src/plugins/zod/v4/toAst/boolean.ts
··· 13 13 const result: Partial<Omit<Ast, 'typeName'>> = {}; 14 14 let chain: ReturnType<typeof $.call>; 15 15 16 - const z = plugin.referenceSymbol({ 17 - category: 'external', 18 - resource: 'zod.z', 19 - }); 16 + const z = plugin.external('zod.z'); 20 17 21 18 if (typeof schema.const === 'boolean') { 22 19 chain = $(z).attr(identifiers.literal).call($.literal(schema.const));
+1 -4
packages/openapi-ts/src/plugins/zod/v4/toAst/enum.ts
··· 14 14 }): Omit<Ast, 'typeName'> => { 15 15 const result: Partial<Omit<Ast, 'typeName'>> = {}; 16 16 17 - const z = plugin.referenceSymbol({ 18 - category: 'external', 19 - resource: 'zod.z', 20 - }); 17 + const z = plugin.external('zod.z'); 21 18 22 19 const enumMembers: Array<ReturnType<typeof $.literal>> = []; 23 20 const literalMembers: Array<ReturnType<typeof $.call>> = [];
+1 -4
packages/openapi-ts/src/plugins/zod/v4/toAst/never.ts
··· 10 10 schema: SchemaWithType<'never'>; 11 11 }): Omit<Ast, 'typeName'> => { 12 12 const result: Partial<Omit<Ast, 'typeName'>> = {}; 13 - const z = plugin.referenceSymbol({ 14 - category: 'external', 15 - resource: 'zod.z', 16 - }); 13 + const z = plugin.external('zod.z'); 17 14 result.expression = $(z).attr(identifiers.never).call(); 18 15 return result as Omit<Ast, 'typeName'>; 19 16 };
+1 -4
packages/openapi-ts/src/plugins/zod/v4/toAst/null.ts
··· 10 10 schema: SchemaWithType<'null'>; 11 11 }): Omit<Ast, 'typeName'> => { 12 12 const result: Partial<Omit<Ast, 'typeName'>> = {}; 13 - const z = plugin.referenceSymbol({ 14 - category: 'external', 15 - resource: 'zod.z', 16 - }); 13 + const z = plugin.external('zod.z'); 17 14 result.expression = $(z).attr(identifiers.null).call(); 18 15 return result as Omit<Ast, 'typeName'>; 19 16 };
+1 -4
packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts
··· 16 16 }): Omit<Ast, 'typeName'> => { 17 17 const result: Partial<Omit<Ast, 'typeName'>> = {}; 18 18 19 - const z = plugin.referenceSymbol({ 20 - category: 'external', 21 - resource: 'zod.z', 22 - }); 19 + const z = plugin.external('zod.z'); 23 20 24 21 if (schema.const && Array.isArray(schema.const)) { 25 22 const tupleElements = schema.const.map((value) =>
+1 -4
packages/openapi-ts/src/plugins/zod/v4/toAst/undefined.ts
··· 10 10 schema: SchemaWithType<'undefined'>; 11 11 }): Omit<Ast, 'typeName'> => { 12 12 const result: Partial<Omit<Ast, 'typeName'>> = {}; 13 - const z = plugin.referenceSymbol({ 14 - category: 'external', 15 - resource: 'zod.z', 16 - }); 13 + const z = plugin.external('zod.z'); 17 14 result.expression = $(z).attr(identifiers.undefined).call(); 18 15 return result as Omit<Ast, 'typeName'>; 19 16 };
+1 -4
packages/openapi-ts/src/plugins/zod/v4/toAst/unknown.ts
··· 10 10 schema: SchemaWithType<'unknown'>; 11 11 }): Omit<Ast, 'typeName'> => { 12 12 const result: Partial<Omit<Ast, 'typeName'>> = {}; 13 - const z = plugin.referenceSymbol({ 14 - category: 'external', 15 - resource: 'zod.z', 16 - }); 13 + const z = plugin.external('zod.z'); 17 14 result.expression = $(z).attr(identifiers.unknown).call(); 18 15 return result as Omit<Ast, 'typeName'>; 19 16 };
+1 -4
packages/openapi-ts/src/plugins/zod/v4/toAst/void.ts
··· 10 10 schema: SchemaWithType<'void'>; 11 11 }): Omit<Ast, 'typeName'> => { 12 12 const result: Partial<Omit<Ast, 'typeName'>> = {}; 13 - const z = plugin.referenceSymbol({ 14 - category: 'external', 15 - resource: 'zod.z', 16 - }); 13 + const z = plugin.external('zod.z'); 17 14 result.expression = $(z).attr(identifiers.void).call(); 18 15 return result as Omit<Ast, 'typeName'>; 19 16 };