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 #3532 from hey-api/feat/plugin-pydantic-resolvers

feat: add resolvers to pydantic

authored by

Lubos and committed by
GitHub
fe5bfba6 750c5d73

+303 -102
+4 -1
dev/python/presets.ts
··· 9 9 containerName: 'OpenCode', 10 10 strategy: 'single', 11 11 }, 12 + paramsStructure: 'flat', 12 13 }), 13 14 ], 14 15 validated: () => [ 15 16 /** SDK + Pydantic validation */ 16 - sdk(), 17 + sdk({ 18 + paramsStructure: 'flat', 19 + }), 17 20 pydantic(), 18 21 ], 19 22 } as const satisfies Record<string, () => ReadonlyArray<PluginConfig>>;
+1 -1
docs/openapi-ts/plugins/concepts/resolvers.md
··· 7 7 8 8 Sometimes the default plugin behavior isn't what you need or expect. Resolvers let you patch plugins in a safe and performant way, without forking or reimplementing core logic. 9 9 10 - Currently available for [Valibot](/openapi-ts/plugins/valibot) and [Zod](/openapi-ts/plugins/zod). 10 + Currently available for [TypeScript](/openapi-ts/plugins/typescript), [Valibot](/openapi-ts/plugins/valibot), and [Zod](/openapi-ts/plugins/zod). 11 11 12 12 ## Examples 13 13
+4
docs/openapi-ts/plugins/typescript.md
··· 166 166 167 167 ::: 168 168 169 + ## Resolvers 170 + 171 + You can further customize this plugin's behavior using [resolvers](/openapi-ts/plugins/concepts/resolvers). 172 + 169 173 ## API 170 174 171 175 You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/typescript/types.ts) interface.
+7
packages/openapi-python/src/plugins/pydantic/index.ts
··· 1 1 export { defaultConfig, defineConfig } from './config'; 2 + export type { 3 + EnumResolverContext, 4 + NumberResolverContext, 5 + ObjectResolverContext, 6 + Resolvers, 7 + StringResolverContext, 8 + } from './resolvers'; 2 9 export type { PydanticPlugin } from './types';
+99
packages/openapi-python/src/plugins/pydantic/resolvers.ts
··· 1 + import type { Plugin, SchemaVisitorContext, SchemaWithType, Walker } from '@hey-api/shared'; 2 + 3 + import type { DollarPyDsl } from '../../py-dsl'; 4 + import type { PydanticField, PydanticFinal, PydanticResult, PydanticType } from './shared/types'; 5 + import type { PydanticPlugin } from './types'; 6 + 7 + export type Resolvers = Plugin.Resolvers<{ 8 + /** 9 + * Resolver for enum schemas. 10 + * 11 + * Allows customization of how enum types are rendered. 12 + * 13 + * Returning `undefined` will execute the default resolver logic. 14 + */ 15 + enum?: (ctx: EnumResolverContext) => PydanticType | undefined; 16 + /** 17 + * Resolver for number schemas. 18 + * 19 + * Allows customization of how number types are rendered. 20 + * 21 + * Returning `undefined` will execute the default resolver logic. 22 + */ 23 + number?: (ctx: NumberResolverContext) => PydanticType | undefined; 24 + /** 25 + * Resolver for object schemas. 26 + * 27 + * Allows customization of how object types are rendered. 28 + * 29 + * Returning `undefined` will execute the default resolver logic. 30 + */ 31 + object?: ( 32 + ctx: ObjectResolverContext, 33 + ) => (PydanticType & { fields?: Array<PydanticField> }) | undefined; 34 + /** 35 + * Resolver for string schemas. 36 + * 37 + * Allows customization of how string types are rendered. 38 + * 39 + * Returning `undefined` will execute the default resolver logic. 40 + */ 41 + string?: (ctx: StringResolverContext) => PydanticType | undefined; 42 + }>; 43 + 44 + interface BaseContext extends DollarPyDsl { 45 + /** The plugin instance. */ 46 + plugin: PydanticPlugin['Instance']; 47 + } 48 + 49 + export interface EnumResolverContext extends BaseContext { 50 + /** 51 + * Nodes used to build different parts of the result. 52 + */ 53 + nodes: { 54 + base: (ctx: EnumResolverContext) => PydanticType; 55 + items: (ctx: EnumResolverContext) => { 56 + enumMembers: Required<PydanticFinal>['enumMembers']; 57 + isNullable: boolean; 58 + }; 59 + }; 60 + schema: SchemaWithType<'enum'>; 61 + } 62 + 63 + export interface NumberResolverContext extends BaseContext { 64 + /** 65 + * Nodes used to build different parts of the result. 66 + */ 67 + nodes: { 68 + base: (ctx: NumberResolverContext) => PydanticType; 69 + const: (ctx: NumberResolverContext) => PydanticType | undefined; 70 + }; 71 + schema: SchemaWithType<'integer' | 'number'>; 72 + } 73 + 74 + export interface ObjectResolverContext extends BaseContext { 75 + _childResults: Array<PydanticResult>; 76 + applyModifiers: (result: PydanticResult, opts: { optional?: boolean }) => PydanticFinal; 77 + /** 78 + * Nodes used to build different parts of the result. 79 + */ 80 + nodes: { 81 + additionalProperties: (ctx: ObjectResolverContext) => PydanticType | null | undefined; 82 + base: (ctx: ObjectResolverContext) => PydanticType & { fields?: Array<PydanticField> }; 83 + fields: (ctx: ObjectResolverContext) => Array<PydanticField>; 84 + }; 85 + schema: SchemaWithType<'object'>; 86 + walk: Walker<PydanticResult, PydanticPlugin['Instance']>; 87 + walkerCtx: SchemaVisitorContext<PydanticPlugin['Instance']>; 88 + } 89 + 90 + export interface StringResolverContext extends BaseContext { 91 + /** 92 + * Nodes used to build different parts of the result. 93 + */ 94 + nodes: { 95 + base: (ctx: StringResolverContext) => PydanticType; 96 + const: (ctx: StringResolverContext) => PydanticType | undefined; 97 + }; 98 + schema: SchemaWithType<'string'>; 99 + }
+6 -2
packages/openapi-python/src/plugins/pydantic/types.ts
··· 7 7 Plugin, 8 8 } from '@hey-api/shared'; 9 9 10 + import type { Resolvers } from './resolvers'; 11 + 10 12 export type UserConfig = Plugin.Name<'pydantic'> & 11 13 Plugin.Hooks & 12 14 Plugin.UserComments & 13 - Plugin.UserExports & { 15 + Plugin.UserExports & 16 + Resolvers & { 14 17 /** 15 18 * Casing convention for generated names. 16 19 * ··· 185 188 export type Config = Plugin.Name<'pydantic'> & 186 189 Plugin.Hooks & 187 190 Plugin.Comments & 188 - Plugin.Exports & { 191 + Plugin.Exports & 192 + Resolvers & { 189 193 /** Casing convention for generated names. */ 190 194 case: Casing; 191 195 /** Configuration for reusable schema definitions. */
+47 -36
packages/openapi-python/src/plugins/pydantic/v2/toAst/enum.ts
··· 1 - import type { Symbol } from '@hey-api/codegen-core'; 2 1 import type { SchemaWithType } from '@hey-api/shared'; 3 2 import { toCase } from '@hey-api/shared'; 4 3 5 4 import { $ } from '../../../../py-dsl'; 5 + import type { EnumResolverContext } from '../../resolvers'; 6 6 import type { PydanticFinal, PydanticType } from '../../shared/types'; 7 7 import type { PydanticPlugin } from '../../types'; 8 8 ··· 21 21 return toCase(value, 'SCREAMING_SNAKE_CASE'); 22 22 } 23 23 24 - function extractEnumMembers( 25 - schema: SchemaWithType<'enum'>, 26 - plugin: PydanticPlugin['Instance'], 27 - ): { 28 - enumMembers: Required<PydanticFinal>['enumMembers']; 29 - isNullable: boolean; 30 - } { 24 + function itemsNode(ctx: EnumResolverContext) { 25 + const { plugin, schema } = ctx; 31 26 const enumMembers: Required<PydanticFinal>['enumMembers'] = []; 32 27 let isNullable = false; 33 28 ··· 51 46 return { enumMembers, isNullable }; 52 47 } 53 48 54 - function toLiteralType( 55 - enumMembers: Required<PydanticFinal>['enumMembers'], 56 - plugin: PydanticPlugin['Instance'], 57 - ): string | Symbol | ReturnType<typeof $.subscript> { 49 + function baseNode(ctx: EnumResolverContext): PydanticType { 50 + const { plugin } = ctx; 51 + const { enumMembers } = ctx.nodes.items(ctx); 52 + 58 53 if (enumMembers.length === 0) { 59 - return plugin.external('typing.Any'); 54 + return { 55 + type: plugin.external('typing.Any'), 56 + }; 57 + } 58 + 59 + const mode = plugin.config.enums ?? 'enum'; 60 + 61 + if (mode === 'literal') { 62 + if (enumMembers.length === 0) { 63 + return { 64 + type: plugin.external('typing.Any'), 65 + }; 66 + } 67 + 68 + const literal = plugin.external('typing.Literal'); 69 + const values = enumMembers.map((m) => 70 + // TODO: replace 71 + typeof m.value === 'string' ? `"<<<<${m.value}"` : `<<<${m.value}`, 72 + ); 73 + 74 + return { 75 + type: $(literal).slice(...values), 76 + }; 60 77 } 61 78 62 - const literal = plugin.external('typing.Literal'); 63 - const values = enumMembers.map((m) => 64 - // TODO: replace 65 - typeof m.value === 'string' ? `"<<<<${m.value}"` : `<<<${m.value}`, 66 - ); 79 + return {}; 80 + } 67 81 68 - return $(literal).slice(...values); 82 + function enumResolver(ctx: EnumResolverContext): PydanticType { 83 + return ctx.nodes.base(ctx); 69 84 } 70 85 71 86 export function enumToType({ 72 - mode = 'enum', 73 87 plugin, 74 88 schema, 75 89 }: { 76 - mode?: 'enum' | 'literal'; 77 90 plugin: PydanticPlugin['Instance']; 78 91 schema: SchemaWithType<'enum'>; 79 92 }): EnumToTypeResult { 80 - const { enumMembers, isNullable } = extractEnumMembers(schema, plugin); 93 + const ctx: EnumResolverContext = { 94 + $, 95 + nodes: { 96 + base: baseNode, 97 + items: itemsNode, 98 + }, 99 + plugin, 100 + schema, 101 + }; 81 102 82 - if (enumMembers.length === 0) { 83 - return { 84 - enumMembers, 85 - isNullable, 86 - type: plugin.external('typing.Any'), 87 - }; 88 - } 103 + const resolver = plugin.config['~resolvers']?.enum; 104 + const resolved = resolver?.(ctx) ?? enumResolver(ctx); 89 105 90 - if (mode === 'literal') { 91 - return { 92 - enumMembers, 93 - isNullable, 94 - type: toLiteralType(enumMembers, plugin), 95 - }; 96 - } 106 + const { enumMembers, isNullable } = ctx.nodes.items(ctx); 97 107 98 108 return { 109 + ...resolved, 99 110 enumMembers, 100 111 isNullable, 101 112 };
+39 -8
packages/openapi-python/src/plugins/pydantic/v2/toAst/number.ts
··· 1 1 import type { SchemaWithType } from '@hey-api/shared'; 2 2 3 3 import { $ } from '../../../../py-dsl'; 4 + import type { NumberResolverContext } from '../../resolvers'; 4 5 import type { PydanticType } from '../../shared/types'; 5 6 import type { PydanticPlugin } from '../../types'; 6 7 import type { FieldConstraints } from '../constants'; 7 8 8 - export function numberToType({ 9 - plugin, 10 - schema, 11 - }: { 12 - plugin: PydanticPlugin['Instance']; 13 - schema: SchemaWithType<'integer' | 'number'>; 14 - }): PydanticType { 15 - const constraints: FieldConstraints = {}; 9 + function constNode(ctx: NumberResolverContext): PydanticType | undefined { 10 + const { plugin, schema } = ctx; 16 11 17 12 if (typeof schema.const === 'number') { 18 13 const literal = plugin.external('typing.Literal'); ··· 21 16 }; 22 17 } 23 18 19 + return undefined; 20 + } 21 + 22 + function baseNode(ctx: NumberResolverContext): PydanticType { 23 + const { schema } = ctx; 24 + 25 + const constraints: FieldConstraints = {}; 26 + 24 27 if (schema.minimum !== undefined) { 25 28 constraints.ge = schema.minimum; 26 29 } ··· 46 49 type: schema.type === 'integer' ? 'int' : 'float', 47 50 }; 48 51 } 52 + 53 + function numberResolver(ctx: NumberResolverContext): PydanticType { 54 + const constResult = ctx.nodes.const(ctx); 55 + if (constResult) return constResult; 56 + 57 + return ctx.nodes.base(ctx); 58 + } 59 + 60 + export function numberToType({ 61 + plugin, 62 + schema, 63 + }: { 64 + plugin: PydanticPlugin['Instance']; 65 + schema: SchemaWithType<'integer' | 'number'>; 66 + }): PydanticType { 67 + const ctx: NumberResolverContext = { 68 + $, 69 + nodes: { 70 + base: baseNode, 71 + const: constNode, 72 + }, 73 + plugin, 74 + schema, 75 + }; 76 + 77 + const resolver = plugin.config['~resolvers']?.number; 78 + return resolver?.(ctx) ?? numberResolver(ctx); 79 + }
+27 -27
packages/openapi-python/src/plugins/pydantic/v2/toAst/object.ts
··· 1 - import type { SchemaVisitorContext, SchemaWithType, Walker } from '@hey-api/shared'; 2 1 import { childContext, toCase } from '@hey-api/shared'; 3 2 4 - import { $, type VarType } from '../../../../py-dsl'; 3 + import { $ } from '../../../../py-dsl'; 5 4 import { safeRuntimeName } from '../../../../py-dsl/utils/name'; 6 - import type { PydanticField, PydanticFinal, PydanticResult } from '../../shared/types'; 7 - import type { PydanticPlugin } from '../../types'; 8 - 9 - interface ObjectResolverContext { 10 - _childResults: Array<PydanticResult>; 11 - applyModifiers: (result: PydanticResult, options?: { optional?: boolean }) => PydanticFinal; 12 - plugin: PydanticPlugin['Instance']; 13 - schema: SchemaWithType<'object'>; 14 - walk: Walker<PydanticResult, PydanticPlugin['Instance']>; 15 - walkerCtx: SchemaVisitorContext<PydanticPlugin['Instance']>; 16 - } 5 + import type { ObjectResolverContext } from '../../resolvers'; 6 + import type { PydanticField, PydanticResult, PydanticType } from '../../shared/types'; 17 7 18 8 export interface ObjectToFieldsResult extends Pick<PydanticResult, 'fields' | 'type'> { 19 9 childResults: Array<PydanticResult>; 20 10 } 21 11 22 - function resolveAdditionalProperties(ctx: ObjectResolverContext): VarType | null | undefined { 12 + function additionalPropertiesNode(ctx: ObjectResolverContext): PydanticType | null | undefined { 23 13 const { schema } = ctx; 24 14 25 15 if (!schema.additionalProperties || !schema.additionalProperties.type) return undefined; ··· 31 21 ); 32 22 ctx._childResults.push(result); 33 23 34 - return result.type; 24 + return { 25 + type: result.type, 26 + }; 35 27 } 36 28 37 - function resolveFields(ctx: ObjectResolverContext): Array<PydanticField> { 29 + function fieldsNode(ctx: ObjectResolverContext): Array<PydanticField> { 38 30 const { schema } = ctx; 39 31 const fields: Array<PydanticField> = []; 40 32 ··· 59 51 return fields; 60 52 } 61 53 62 - function objectResolver(ctx: ObjectResolverContext): Omit<ObjectToFieldsResult, 'childResults'> { 63 - const additional = resolveAdditionalProperties(ctx); 54 + function baseNode(ctx: ObjectResolverContext): PydanticType & { fields?: Array<PydanticField> } { 55 + const additional = additionalPropertiesNode(ctx); 64 56 65 - // additionalProperties: false → strict — still emit a class, just no extra fields 66 - // additionalProperties: { type: 'never' } → null sentinel → strict class 67 57 if (additional === null) { 68 - const fields = resolveFields(ctx); 58 + const fields = fieldsNode(ctx); 69 59 return { fields }; 70 60 } 71 61 ··· 77 67 return { type: $('dict').slice('str', any) }; 78 68 } 79 69 80 - // additionalProperties with properties → class wins, additional props ignored for now 81 70 // TODO: consider model_config = ConfigDict(extra='allow') 82 71 if (ctx.schema.properties) { 83 - const fields = resolveFields(ctx); 72 + const fields = fieldsNode(ctx); 84 73 return { fields }; 85 74 } 86 75 ··· 88 77 return { type: $('dict').slice('str', any) }; 89 78 } 90 79 80 + function objectResolver(ctx: ObjectResolverContext): PydanticType { 81 + return ctx.nodes.base(ctx); 82 + } 83 + 91 84 export function objectToFields( 92 85 ctx: Pick<ObjectResolverContext, 'applyModifiers' | 'plugin' | 'schema' | 'walk' | 'walkerCtx'>, 93 86 ): ObjectToFieldsResult { ··· 95 88 const childResults: Array<PydanticResult> = []; 96 89 97 90 const extendedCtx: ObjectResolverContext = { 91 + $, 98 92 _childResults: childResults, 99 93 applyModifiers, 94 + nodes: { 95 + additionalProperties: additionalPropertiesNode, 96 + base: baseNode, 97 + fields: fieldsNode, 98 + }, 100 99 plugin, 101 100 schema, 102 101 walk, 103 102 walkerCtx, 104 103 }; 105 104 106 - // const resolver = plugin.config?.['~resolvers']?.object; 107 - // const resolved = resolver?.(extendedCtx) ?? objectResolver(extendedCtx); 108 - const resolved = objectResolver(extendedCtx); 105 + const resolver = plugin.config['~resolvers']?.object; 106 + const resolved = resolver?.(extendedCtx) ?? objectResolver(extendedCtx); 107 + 108 + const childResultsFinal = extendedCtx._childResults; 109 109 110 - return { childResults, ...resolved }; 110 + return { childResults: childResultsFinal, ...resolved }; 111 111 }
+39 -8
packages/openapi-python/src/plugins/pydantic/v2/toAst/string.ts
··· 1 1 import type { SchemaWithType } from '@hey-api/shared'; 2 2 3 3 import { $ } from '../../../../py-dsl'; 4 + import type { StringResolverContext } from '../../resolvers'; 4 5 import type { PydanticType } from '../../shared/types'; 5 6 import type { PydanticPlugin } from '../../types'; 6 7 import type { FieldConstraints } from '../constants'; 7 8 8 - export function stringToType({ 9 - plugin, 10 - schema, 11 - }: { 12 - plugin: PydanticPlugin['Instance']; 13 - schema: SchemaWithType<'string'>; 14 - }): PydanticType { 15 - const constraints: FieldConstraints = {}; 9 + function constNode(ctx: StringResolverContext): PydanticType | undefined { 10 + const { plugin, schema } = ctx; 16 11 17 12 if (typeof schema.const === 'string') { 18 13 const literal = plugin.external('typing.Literal'); ··· 21 16 }; 22 17 } 23 18 19 + return undefined; 20 + } 21 + 22 + function baseNode(ctx: StringResolverContext): PydanticType { 23 + const { schema } = ctx; 24 + 25 + const constraints: FieldConstraints = {}; 26 + 24 27 if (schema.minLength !== undefined) { 25 28 constraints.min_length = schema.minLength; 26 29 } ··· 42 45 type: 'str', 43 46 }; 44 47 } 48 + 49 + function stringResolver(ctx: StringResolverContext): PydanticType { 50 + const constResult = ctx.nodes.const(ctx); 51 + if (constResult) return constResult; 52 + 53 + return ctx.nodes.base(ctx); 54 + } 55 + 56 + export function stringToType({ 57 + plugin, 58 + schema, 59 + }: { 60 + plugin: PydanticPlugin['Instance']; 61 + schema: SchemaWithType<'string'>; 62 + }): PydanticType { 63 + const ctx: StringResolverContext = { 64 + $, 65 + nodes: { 66 + base: baseNode, 67 + const: constNode, 68 + }, 69 + plugin, 70 + schema, 71 + }; 72 + 73 + const resolver = plugin.config['~resolvers']?.string; 74 + return resolver?.(ctx) ?? stringResolver(ctx); 75 + }
+1 -2
packages/openapi-python/src/plugins/pydantic/v2/walker.ts
··· 85 85 }; 86 86 }, 87 87 enum(schema, ctx) { 88 - const mode = ctx.plugin.config.enums ?? 'enum'; 89 - const result = enumToType({ mode, plugin: ctx.plugin, schema }); 88 + const result = enumToType({ plugin: ctx.plugin, schema }); 90 89 return { 91 90 ...result, 92 91 meta: defaultMeta(schema),
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/resolvers.ts
··· 1 1 import type { Plugin, SchemaVisitorContext, SchemaWithType, Walker } from '@hey-api/shared'; 2 2 3 3 import type { $, DollarTsDsl } from '../../../ts-dsl'; 4 - import type { HeyApiTypeScriptPlugin, Type, TypeScriptResult } from './shared/types'; 4 + import type { Type, TypeScriptResult } from './shared/types'; 5 + import type { HeyApiTypeScriptPlugin } from './types'; 5 6 6 7 export type Resolvers = Plugin.Resolvers<{ 7 8 /**
-2
packages/openapi-ts/src/plugins/@hey-api/typescript/shared/types.ts
··· 2 2 3 3 import type { MaybeTsDsl, TypeTsDsl } from '../../../../ts-dsl'; 4 4 5 - export type { HeyApiTypeScriptPlugin } from '../types'; 6 - 7 5 export type Type = MaybeTsDsl<TypeTsDsl>; 8 6 9 7 /**
+1 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhook.ts
··· 4 4 5 5 import { createSchemaComment } from '../../../../plugins/shared/utils/schema'; 6 6 import { $ } from '../../../../ts-dsl'; 7 + import type { HeyApiTypeScriptPlugin } from '../types'; 7 8 import { createProcessor } from '../v1/processor'; 8 - import type { HeyApiTypeScriptPlugin } from './types'; 9 9 10 10 export function webhookToType({ 11 11 operation,
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/array.ts
··· 4 4 import { deduplicateSchema } from '@hey-api/shared'; 5 5 6 6 import { $ } from '../../../../../ts-dsl'; 7 - import type { HeyApiTypeScriptPlugin, Type } from '../../shared/types'; 7 + import type { Type } from '../../shared/types'; 8 8 import type { TypeScriptResult } from '../../shared/types'; 9 + import type { HeyApiTypeScriptPlugin } from '../../types'; 9 10 10 11 export function arrayToAst({ 11 12 plugin,
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/boolean.ts
··· 1 1 import type { SchemaWithType } from '@hey-api/shared'; 2 2 3 3 import { $ } from '../../../../../ts-dsl'; 4 - import type { HeyApiTypeScriptPlugin, Type } from '../../shared/types'; 4 + import type { Type } from '../../shared/types'; 5 + import type { HeyApiTypeScriptPlugin } from '../../types'; 5 6 6 7 export function booleanToAst({ 7 8 schema,
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/enum.ts
··· 2 2 3 3 import { $ } from '../../../../../ts-dsl'; 4 4 import type { EnumResolverContext } from '../../resolvers'; 5 - import type { HeyApiTypeScriptPlugin, Type } from '../../shared/types'; 5 + import type { Type } from '../../shared/types'; 6 6 import type { TypeScriptEnumData } from '../../shared/types'; 7 + import type { HeyApiTypeScriptPlugin } from '../../types'; 7 8 8 9 function buildEnumData( 9 10 plugin: HeyApiTypeScriptPlugin['Instance'],
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/never.ts
··· 1 1 import type { SchemaWithType } from '@hey-api/shared'; 2 2 3 3 import { $ } from '../../../../../ts-dsl'; 4 - import type { HeyApiTypeScriptPlugin, Type } from '../../shared/types'; 4 + import type { Type } from '../../shared/types'; 5 + import type { HeyApiTypeScriptPlugin } from '../../types'; 5 6 6 7 // eslint-disable-next-line @typescript-eslint/no-unused-vars 7 8 export function neverToAst(args: {
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/null.ts
··· 1 1 import type { SchemaWithType } from '@hey-api/shared'; 2 2 3 3 import { $ } from '../../../../../ts-dsl'; 4 - import type { HeyApiTypeScriptPlugin, Type } from '../../shared/types'; 4 + import type { Type } from '../../shared/types'; 5 + import type { HeyApiTypeScriptPlugin } from '../../types'; 5 6 6 7 // eslint-disable-next-line @typescript-eslint/no-unused-vars 7 8 export function nullToAst(args: {
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/number.ts
··· 2 2 3 3 import { $ } from '../../../../../ts-dsl'; 4 4 import type { NumberResolverContext } from '../../resolvers'; 5 - import type { HeyApiTypeScriptPlugin, Type } from '../../shared/types'; 5 + import type { Type } from '../../shared/types'; 6 + import type { HeyApiTypeScriptPlugin } from '../../types'; 6 7 7 8 function constNode(ctx: NumberResolverContext): Type | undefined { 8 9 const { schema } = ctx;
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/object.ts
··· 5 5 import { createSchemaComment } from '../../../../../plugins/shared/utils/schema'; 6 6 import { $ } from '../../../../../ts-dsl'; 7 7 import type { ObjectResolverContext } from '../../resolvers'; 8 - import type { HeyApiTypeScriptPlugin, Type } from '../../shared/types'; 8 + import type { Type } from '../../shared/types'; 9 9 import type { TypeScriptResult } from '../../shared/types'; 10 + import type { HeyApiTypeScriptPlugin } from '../../types'; 10 11 11 12 function shapeNode(ctx: ObjectResolverContext): ReturnType<typeof $.type.object> { 12 13 const { schema, walk, walkerCtx } = ctx;
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/string.ts
··· 4 4 5 5 import { $ } from '../../../../../ts-dsl'; 6 6 import type { StringResolverContext } from '../../resolvers'; 7 - import type { HeyApiTypeScriptPlugin, Type } from '../../shared/types'; 7 + import type { Type } from '../../shared/types'; 8 + import type { HeyApiTypeScriptPlugin } from '../../types'; 8 9 9 10 function constNode(ctx: StringResolverContext): Type | undefined { 10 11 const { schema } = ctx;
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/tuple.ts
··· 3 3 import type { Walker } from '@hey-api/shared'; 4 4 5 5 import { $ } from '../../../../../ts-dsl'; 6 - import type { HeyApiTypeScriptPlugin, Type } from '../../shared/types'; 6 + import type { Type } from '../../shared/types'; 7 7 import type { TypeScriptResult } from '../../shared/types'; 8 + import type { HeyApiTypeScriptPlugin } from '../../types'; 8 9 9 10 export function tupleToAst({ 10 11 plugin,
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/undefined.ts
··· 1 1 import type { SchemaWithType } from '@hey-api/shared'; 2 2 3 3 import { $ } from '../../../../../ts-dsl'; 4 - import type { HeyApiTypeScriptPlugin, Type } from '../../shared/types'; 4 + import type { Type } from '../../shared/types'; 5 + import type { HeyApiTypeScriptPlugin } from '../../types'; 5 6 6 7 // eslint-disable-next-line @typescript-eslint/no-unused-vars 7 8 export function undefinedToAst(args: {
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/unknown.ts
··· 1 1 import type { SchemaWithType } from '@hey-api/shared'; 2 2 3 3 import { $ } from '../../../../../ts-dsl'; 4 - import type { HeyApiTypeScriptPlugin, Type } from '../../shared/types'; 4 + import type { Type } from '../../shared/types'; 5 + import type { HeyApiTypeScriptPlugin } from '../../types'; 5 6 6 7 export function unknownToAst({ 7 8 plugin,
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/void.ts
··· 1 1 import type { SchemaWithType } from '@hey-api/shared'; 2 2 3 3 import { $ } from '../../../../../ts-dsl'; 4 - import type { HeyApiTypeScriptPlugin, Type } from '../../shared/types'; 4 + import type { Type } from '../../shared/types'; 5 + import type { HeyApiTypeScriptPlugin } from '../../types'; 5 6 6 7 // eslint-disable-next-line @typescript-eslint/no-unused-vars 7 8 export function voidToAst(args: {
+2 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/walker.ts
··· 5 5 import { $ } from '../../../../ts-dsl'; 6 6 import { defaultMeta, inheritMeta } from '../shared/meta'; 7 7 import type { ProcessorContext } from '../shared/processor'; 8 - import type { HeyApiTypeScriptPlugin, TypeScriptResult } from '../shared/types'; 8 + import type { TypeScriptResult } from '../shared/types'; 9 + import type { HeyApiTypeScriptPlugin } from '../types'; 9 10 import { arrayToAst } from './toAst/array'; 10 11 import { booleanToAst } from './toAst/boolean'; 11 12 import { enumToAst } from './toAst/enum';