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 #3618 from hey-api/fix/transformers-plugin-arg-3

authored by

Lubos and committed by
GitHub
e1633668 f10429be

+8 -5
+1 -1
.changeset/two-cameras-check.md
··· 2 2 "@hey-api/openapi-ts": patch 3 3 --- 4 4 5 - **plugin(@hey-api/transformers)**: expose plugin in transformer function context 5 + **plugin(@hey-api/transformers)**: expose `plugin` and `$` in transformer function context
+3 -1
dev/typescript/presets.ts
··· 16 16 name: '@hey-api/sdk', 17 17 paramsStructure: 'flat', 18 18 }, 19 - '@hey-api/transformers', 19 + { 20 + name: '@hey-api/transformers', 21 + }, 20 22 { 21 23 metadata: true, 22 24 name: 'zod',
+1
packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts
··· 265 265 266 266 for (const transformer of plugin.config.transformers) { 267 267 const t = transformer({ 268 + $, 268 269 config: plugin.config, 269 270 dataExpression, 270 271 plugin,
+2 -2
packages/openapi-ts/src/plugins/@hey-api/transformers/types.ts
··· 2 2 import type { DefinePlugin, Plugin } from '@hey-api/shared'; 3 3 import type ts from 'typescript'; 4 4 5 - import type { $, MaybeTsDsl, TsDsl } from '../../../ts-dsl'; 5 + import type { $, DollarTsDsl, MaybeTsDsl, TsDsl } from '../../../ts-dsl'; 6 6 7 - interface BaseTransformer { 7 + interface BaseTransformer extends DollarTsDsl { 8 8 plugin: HeyApiTransformersPlugin['Instance']; 9 9 schema: IR.SchemaObject; 10 10 }
+1 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/walker.ts
··· 94 94 const transformersPlugin = ctx.plugin.getPlugin('@hey-api/transformers'); 95 95 if (transformersPlugin?.config.typeTransformers) { 96 96 for (const typeTransformer of transformersPlugin.config.typeTransformers) { 97 - const typeNode = typeTransformer({ plugin: transformersPlugin, schema }); 97 + const typeNode = typeTransformer({ $, plugin: transformersPlugin, schema }); 98 98 if (typeNode) { 99 99 return { meta: defaultMeta(schema), type: typeNode }; 100 100 }