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 #2839 from hey-api/refactor/typescript-plugin

refactor: clean up typescript plugin

authored by

Lubos and committed by
GitHub
73288fb8 972b93e4

+1015 -751
+1 -1
packages/openapi-ts/src/generate/client.ts
··· 4 4 5 5 import type { IProject, ProjectRenderMeta } from '@hey-api/codegen-core'; 6 6 7 + import type { DefinePlugin } from '~/plugins'; 7 8 import type { Client } from '~/plugins/@hey-api/client-core/types'; 8 9 import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; 9 - import type { DefinePlugin } from '~/plugins/types'; 10 10 import type { Config } from '~/types/config'; 11 11 12 12 import { ensureDirSync, relativeModulePath } from './utils';
+1 -1
packages/openapi-ts/src/index.ts
··· 186 186 OpenApiResponseObject, 187 187 OpenApiSchemaObject, 188 188 } from './openApi/types'; 189 + export type { DefinePlugin, Plugin } from './plugins'; 189 190 export type { AngularClient } from './plugins/@hey-api/client-angular'; 190 191 export type { AxiosClient } from './plugins/@hey-api/client-axios'; 191 192 export { ··· 201 202 export type { ExpressionTransformer } from './plugins/@hey-api/transformers/expressions'; 202 203 export type { TypeTransformer } from './plugins/@hey-api/transformers/types'; 203 204 export { definePluginConfig } from './plugins/shared/utils/config'; 204 - export type { DefinePlugin, Plugin } from './plugins/types'; 205 205 export { compiler, tsc } from './tsc'; 206 206 export type { UserConfig } from './types/config'; 207 207 export type { LegacyIR } from './types/types';
+1 -1
packages/openapi-ts/src/plugins/@angular/common/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 6 6 | 'class'
+1 -1
packages/openapi-ts/src/plugins/@angular/common/types.d.ts
··· 1 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 2 2 import type { StringName } from '~/types/case'; 3 3 4 4 import type { IApi } from './api';
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-angular/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 'client'; 6 6
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-angular/types.d.ts
··· 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 1 2 import type { Client } from '~/plugins/@hey-api/client-core/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 3 3 4 4 import type { IApi } from './api'; 5 5
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-axios/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 'client'; 6 6
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-axios/types.d.ts
··· 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 1 2 import type { Client } from '~/plugins/@hey-api/client-core/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 3 3 4 4 import type { IApi } from './api'; 5 5
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-core/types.d.ts
··· 1 + import type { Plugin } from '~/plugins'; 1 2 import type { HeyApiClientAngularPlugin } from '~/plugins/@hey-api/client-angular'; 2 3 import type { HeyApiClientAxiosPlugin } from '~/plugins/@hey-api/client-axios'; 3 4 import type { HeyApiClientFetchPlugin } from '~/plugins/@hey-api/client-fetch'; 4 5 import type { HeyApiClientNextPlugin } from '~/plugins/@hey-api/client-next'; 5 6 import type { HeyApiClientNuxtPlugin } from '~/plugins/@hey-api/client-nuxt'; 6 7 import type { HeyApiClientOfetchPlugin } from '~/plugins/@hey-api/client-ofetch'; 7 - import type { Plugin } from '~/plugins/types'; 8 8 9 9 export interface PluginHandler { 10 10 (...args: Parameters<HeyApiClientAngularPlugin['Handler']>): void;
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-fetch/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 'client'; 6 6
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-fetch/types.d.ts
··· 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 1 2 import type { Client } from '~/plugins/@hey-api/client-core/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 3 3 4 4 import type { IApi } from './api'; 5 5
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-next/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 'client'; 6 6
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-next/types.d.ts
··· 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 1 2 import type { Client } from '~/plugins/@hey-api/client-core/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 3 3 4 4 import type { IApi } from './api'; 5 5
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-nuxt/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 'client'; 6 6
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-nuxt/types.d.ts
··· 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 1 2 import type { Client } from '~/plugins/@hey-api/client-core/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 3 3 4 4 import type { IApi } from './api'; 5 5
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-ofetch/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 'client'; 6 6
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-ofetch/types.d.ts
··· 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 1 2 import type { Client } from '~/plugins/@hey-api/client-core/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 3 3 4 4 import type { IApi } from './api'; 5 5
+1 -1
packages/openapi-ts/src/plugins/@hey-api/legacy-angular/types.d.ts
··· 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 1 2 import type { Client } from '~/plugins/@hey-api/client-core/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 3 3 4 4 export type UserConfig = Plugin.Name<'legacy/angular'> & 5 5 Pick<Client.Config, 'output'>;
+1 -1
packages/openapi-ts/src/plugins/@hey-api/legacy-axios/types.d.ts
··· 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 1 2 import type { Client } from '~/plugins/@hey-api/client-core/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 3 3 4 4 export type UserConfig = Plugin.Name<'legacy/axios'> & 5 5 Pick<Client.Config, 'output'>;
+1 -1
packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/types.d.ts
··· 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 1 2 import type { Client } from '~/plugins/@hey-api/client-core/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 3 3 4 4 export type UserConfig = Plugin.Name<'legacy/fetch'> & 5 5 Pick<Client.Config, 'output'>;
+1 -1
packages/openapi-ts/src/plugins/@hey-api/legacy-node/types.d.ts
··· 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 1 2 import type { Client } from '~/plugins/@hey-api/client-core/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 3 3 4 4 export type UserConfig = Plugin.Name<'legacy/node'> & 5 5 Pick<Client.Config, 'output'>;
+1 -1
packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/types.d.ts
··· 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 1 2 import type { Client } from '~/plugins/@hey-api/client-core/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 3 3 4 4 export type UserConfig = Plugin.Name<'legacy/xhr'> & 5 5 Pick<Client.Config, 'output'>;
+1 -1
packages/openapi-ts/src/plugins/@hey-api/schemas/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 'ref'; 6 6
+1 -1
packages/openapi-ts/src/plugins/@hey-api/schemas/types.d.ts
··· 2 2 import type { OpenApiV2_0_XTypes } from '~/openApi/2.0.x'; 3 3 import type { OpenApiV3_0_XTypes } from '~/openApi/3.0.x'; 4 4 import type { OpenApiV3_1_XTypes } from '~/openApi/3.1.x'; 5 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 5 + import type { DefinePlugin, Plugin } from '~/plugins'; 6 6 7 7 import type { IApi } from './api'; 8 8
+1 -1
packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 import { createOperationComment } from './comment'; 6 6
+15
packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts
··· 228 228 type: pluginTypeScript.api.schemaToType({ 229 229 plugin: pluginTypeScript, 230 230 schema: parameter.schema, 231 + state: { 232 + path: { 233 + value: [], 234 + }, 235 + }, 231 236 }), 232 237 }); 233 238 } ··· 249 254 type: pluginTypeScript.api.schemaToType({ 250 255 plugin: pluginTypeScript, 251 256 schema: parameter.schema, 257 + state: { 258 + path: { 259 + value: [], 260 + }, 261 + }, 252 262 }), 253 263 }); 254 264 } ··· 265 275 type: pluginTypeScript.api.schemaToType({ 266 276 plugin: pluginTypeScript, 267 277 schema: operation.body.schema, 278 + state: { 279 + path: { 280 + value: [], 281 + }, 282 + }, 268 283 }), 269 284 }); 270 285 }
+2 -6
packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts
··· 1 1 import type { IR } from '~/ir/types'; 2 - import type { 3 - DefinePlugin, 4 - Plugin, 5 - PluginClientNames, 6 - PluginValidatorNames, 7 - } from '~/plugins/types'; 2 + import type { DefinePlugin, Plugin } from '~/plugins'; 3 + import type { PluginClientNames, PluginValidatorNames } from '~/plugins/types'; 8 4 import type { StringName } from '~/types/case'; 9 5 import type { Operation } from '~/types/client'; 10 6
+1 -1
packages/openapi-ts/src/plugins/@hey-api/transformers/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 'response' | 'response-ref'; 6 6
+1
packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts
··· 61 61 const selector = plugin.api.selector('response-ref', schema.$ref); 62 62 63 63 if (!plugin.getSymbol(selector)) { 64 + // TODO: remove 64 65 // create each schema response transformer only once 65 66 const refSchema = plugin.context.resolveIrRef<IR.SchemaObject>( 66 67 schema.$ref,
+1 -1
packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 3 import type { IR } from '~/ir/types'; 4 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 4 + import type { DefinePlugin, Plugin } from '~/plugins'; 5 5 6 6 import type { IApi } from './api'; 7 7 import type { ExpressionTransformer } from './expressions';
+5 -5
packages/openapi-ts/src/plugins/@hey-api/typescript/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 import type ts from 'typescript'; 3 3 4 - import type { Plugin } from '~/plugins/types'; 4 + import type { Plugin } from '~/plugins'; 5 5 6 - import { schemaToType } from './plugin'; 6 + import { irSchemaToAstV1 } from './v1/api'; 7 7 8 8 type SelectorType = 9 9 | 'ClientOptions' ··· 19 19 | 'Webhooks'; 20 20 21 21 export type IApi = { 22 - schemaToType: (args: Parameters<typeof schemaToType>[0]) => ts.TypeNode; 22 + schemaToType: (args: Parameters<typeof irSchemaToAstV1>[0]) => ts.TypeNode; 23 23 /** 24 24 * @param type Selector type. 25 25 * @param value Depends on `type`: ··· 46 46 return [this.meta.name, ...(args as Selector)]; 47 47 } 48 48 49 - schemaToType(args: Parameters<typeof schemaToType>[0]): ts.TypeNode { 50 - return schemaToType(args); 49 + schemaToType(args: Parameters<typeof irSchemaToAstV1>[0]): ts.TypeNode { 50 + return irSchemaToAstV1(args); 51 51 } 52 52 }
+1 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/clientOptions.ts packages/openapi-ts/src/plugins/@hey-api/typescript/shared/clientOptions.ts
··· 9 9 import { tsc } from '~/tsc'; 10 10 import { parseUrl } from '~/utils/url'; 11 11 12 - import type { HeyApiTypeScriptPlugin } from './types'; 12 + import type { HeyApiTypeScriptPlugin } from '../types'; 13 13 14 14 const stringType = tsc.keywordTypeNode({ keyword: 'string' }); 15 15
+1 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/export.ts packages/openapi-ts/src/plugins/@hey-api/typescript/shared/export.ts
··· 7 7 import { numberRegExp } from '~/utils/regexp'; 8 8 import { stringCase } from '~/utils/stringCase'; 9 9 10 - import type { HeyApiTypeScriptPlugin } from './types'; 10 + import type { HeyApiTypeScriptPlugin } from '../types'; 11 11 12 12 const schemaToEnumObject = ({ 13 13 plugin,
+18 -10
packages/openapi-ts/src/plugins/@hey-api/typescript/operation.ts packages/openapi-ts/src/plugins/@hey-api/typescript/shared/operation.ts
··· 4 4 import { buildName } from '~/openApi/shared/utils/name'; 5 5 import { tsc } from '~/tsc'; 6 6 7 - import { schemaToType } from './plugin'; 8 - import type { HeyApiTypeScriptPlugin } from './types'; 7 + import { irSchemaToAst } from '../v1/plugin'; 8 + import type { IrSchemaToAstOptions } from './types'; 9 9 10 10 const irParametersToIrSchema = ({ 11 11 parameters, ··· 46 46 const operationToDataType = ({ 47 47 operation, 48 48 plugin, 49 - }: { 49 + state, 50 + }: IrSchemaToAstOptions & { 50 51 operation: IR.OperationObject; 51 - plugin: HeyApiTypeScriptPlugin['Instance']; 52 52 }) => { 53 53 const data: IR.SchemaObject = { 54 54 type: 'object', ··· 124 124 exported: true, 125 125 meta: { 126 126 kind: 'type', 127 + path: state.path.value, 127 128 }, 128 129 name: buildName({ 129 130 config: plugin.config.requests, ··· 131 132 }), 132 133 selector: plugin.api.selector('data', operation.id), 133 134 }); 134 - const type = schemaToType({ 135 + const type = irSchemaToAst({ 135 136 plugin, 136 137 schema: data, 138 + state, 137 139 }); 138 140 const node = tsc.typeAliasDeclaration({ 139 141 exportType: symbol.exported, ··· 146 148 export const operationToType = ({ 147 149 operation, 148 150 plugin, 149 - }: { 151 + state, 152 + }: IrSchemaToAstOptions & { 150 153 operation: IR.OperationObject; 151 - plugin: HeyApiTypeScriptPlugin['Instance']; 152 154 }) => { 153 - operationToDataType({ operation, plugin }); 155 + operationToDataType({ operation, plugin, state }); 154 156 155 157 const { error, errors, response, responses } = 156 158 operationResponsesMap(operation); ··· 160 162 exported: true, 161 163 meta: { 162 164 kind: 'type', 165 + path: state.path.value, 163 166 }, 164 167 name: buildName({ 165 168 config: plugin.config.errors, ··· 167 170 }), 168 171 selector: plugin.api.selector('errors', operation.id), 169 172 }); 170 - const type = schemaToType({ 173 + const type = irSchemaToAst({ 171 174 plugin, 172 175 schema: errors, 176 + state, 173 177 }); 174 178 const node = tsc.typeAliasDeclaration({ 175 179 exportType: symbolErrors.exported, ··· 183 187 exported: true, 184 188 meta: { 185 189 kind: 'type', 190 + path: state.path.value, 186 191 }, 187 192 name: buildName({ 188 193 config: { ··· 216 221 exported: true, 217 222 meta: { 218 223 kind: 'type', 224 + path: state.path.value, 219 225 }, 220 226 name: buildName({ 221 227 config: plugin.config.responses, ··· 223 229 }), 224 230 selector: plugin.api.selector('responses', operation.id), 225 231 }); 226 - const type = schemaToType({ 232 + const type = irSchemaToAst({ 227 233 plugin, 228 234 schema: responses, 235 + state, 229 236 }); 230 237 const node = tsc.typeAliasDeclaration({ 231 238 exportType: symbolResponses.exported, ··· 239 246 exported: true, 240 247 meta: { 241 248 kind: 'type', 249 + path: state.path.value, 242 250 }, 243 251 name: buildName({ 244 252 config: {
+3 -604
packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts
··· 1 - import type ts from 'typescript'; 2 - 3 - import { deduplicateSchema } from '~/ir/schema'; 4 - import type { IR } from '~/ir/types'; 5 - import { buildName } from '~/openApi/shared/utils/name'; 6 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 7 - import { fieldName } from '~/plugins/shared/utils/case'; 8 - import { createSchemaComment } from '~/plugins/shared/utils/schema'; 9 - import type { Property } from '~/tsc'; 10 - import { tsc } from '~/tsc'; 11 - import { refToName } from '~/utils/ref'; 12 - import { stringCase } from '~/utils/stringCase'; 13 - 14 - import { createClientOptions } from './clientOptions'; 15 - import { exportType } from './export'; 16 - import { operationToType } from './operation'; 17 1 import type { HeyApiTypeScriptPlugin } from './types'; 18 - import { webhookToType } from './webhook'; 19 - import { createWebhooks } from './webhooks'; 20 - 21 - const arrayTypeToIdentifier = ({ 22 - plugin, 23 - schema, 24 - }: { 25 - plugin: HeyApiTypeScriptPlugin['Instance']; 26 - schema: SchemaWithType<'array'>; 27 - }): ts.TypeNode => { 28 - if (!schema.items) { 29 - return tsc.typeArrayNode( 30 - tsc.keywordTypeNode({ keyword: plugin.config.topType }), 31 - ); 32 - } 33 - 34 - schema = deduplicateSchema({ detectFormat: true, schema }); 35 - 36 - const itemTypes: Array<ts.TypeNode> = []; 37 - 38 - for (const item of schema.items!) { 39 - const type = schemaToType({ 40 - plugin, 41 - schema: item, 42 - }); 43 - itemTypes.push(type); 44 - } 45 - 46 - if (itemTypes.length === 1) { 47 - return tsc.typeArrayNode(itemTypes[0]!); 48 - } 49 - 50 - if (schema.logicalOperator === 'and') { 51 - return tsc.typeArrayNode(tsc.typeIntersectionNode({ types: itemTypes })); 52 - } 53 - 54 - return tsc.typeArrayNode(tsc.typeUnionNode({ types: itemTypes })); 55 - }; 56 - 57 - const booleanTypeToIdentifier = ({ 58 - schema, 59 - }: { 60 - schema: SchemaWithType<'boolean'>; 61 - }): ts.TypeNode => { 62 - if (schema.const !== undefined) { 63 - return tsc.literalTypeNode({ 64 - literal: tsc.ots.boolean(schema.const as boolean), 65 - }); 66 - } 67 - 68 - return tsc.keywordTypeNode({ 69 - keyword: 'boolean', 70 - }); 71 - }; 72 - 73 - const enumTypeToIdentifier = ({ 74 - plugin, 75 - schema, 76 - }: { 77 - plugin: HeyApiTypeScriptPlugin['Instance']; 78 - schema: SchemaWithType<'enum'>; 79 - }): ts.TypeNode => { 80 - const type = schemaToType({ 81 - plugin, 82 - schema: { 83 - ...schema, 84 - type: undefined, 85 - }, 86 - }); 87 - return type; 88 - }; 89 - 90 - const numberTypeToIdentifier = ({ 91 - plugin, 92 - schema, 93 - }: { 94 - plugin: HeyApiTypeScriptPlugin['Instance']; 95 - schema: SchemaWithType<'integer' | 'number'>; 96 - }): ts.TypeNode => { 97 - if (schema.const !== undefined) { 98 - return tsc.literalTypeNode({ 99 - literal: tsc.ots.number(schema.const as number), 100 - }); 101 - } 102 - 103 - if (schema.type === 'integer' && schema.format === 'int64') { 104 - // TODO: parser - add ability to skip type transformers 105 - if (plugin.getPlugin('@hey-api/transformers')?.config.bigInt) { 106 - return tsc.typeReferenceNode({ typeName: 'bigint' }); 107 - } 108 - } 109 - 110 - return tsc.keywordTypeNode({ 111 - keyword: 'number', 112 - }); 113 - }; 114 - 115 - const objectTypeToIdentifier = ({ 116 - plugin, 117 - schema, 118 - }: { 119 - plugin: HeyApiTypeScriptPlugin['Instance']; 120 - schema: SchemaWithType<'object'>; 121 - }): ts.TypeNode => { 122 - // TODO: parser - handle constants 123 - let indexKey: ts.TypeReferenceNode | undefined; 124 - let indexProperty: Property | undefined; 125 - const schemaProperties: Array<Property> = []; 126 - let indexPropertyItems: Array<IR.SchemaObject> = []; 127 - const required = schema.required ?? []; 128 - let hasOptionalProperties = false; 129 - 130 - for (const name in schema.properties) { 131 - const property = schema.properties[name]!; 132 - const propertyType = schemaToType({ 133 - plugin, 134 - schema: property, 135 - }); 136 - const isRequired = required.includes(name); 137 - schemaProperties.push({ 138 - comment: createSchemaComment({ schema: property }), 139 - isReadOnly: property.accessScope === 'read', 140 - isRequired, 141 - name: fieldName({ context: plugin.context, name }), 142 - type: propertyType, 143 - }); 144 - indexPropertyItems.push(property); 145 - 146 - if (!isRequired) { 147 - hasOptionalProperties = true; 148 - } 149 - } 150 - 151 - // include pattern value schemas into the index union 152 - if (schema.patternProperties) { 153 - for (const pattern in schema.patternProperties) { 154 - const ir = schema.patternProperties[pattern]!; 155 - indexPropertyItems.unshift(ir); 156 - } 157 - } 158 - 159 - const hasPatterns = 160 - !!schema.patternProperties && 161 - Object.keys(schema.patternProperties).length > 0; 162 - 163 - const addPropsRaw = schema.additionalProperties; 164 - const addPropsObj = 165 - addPropsRaw !== false && addPropsRaw 166 - ? (addPropsRaw as IR.SchemaObject) 167 - : undefined; 168 - const shouldCreateIndex = 169 - hasPatterns || 170 - (!!addPropsObj && 171 - (addPropsObj.type !== 'never' || !indexPropertyItems.length)); 172 - 173 - if (shouldCreateIndex) { 174 - // only inject additionalProperties when it’s not "never" 175 - const addProps = addPropsObj; 176 - if (addProps && addProps.type !== 'never') { 177 - indexPropertyItems.unshift(addProps); 178 - } else if ( 179 - !hasPatterns && 180 - !indexPropertyItems.length && 181 - addProps && 182 - addProps.type === 'never' 183 - ) { 184 - // keep "never" only when there are NO patterns and NO explicit properties 185 - indexPropertyItems = [addProps]; 186 - } 187 - 188 - if (hasOptionalProperties) { 189 - indexPropertyItems.push({ 190 - type: 'undefined', 191 - }); 192 - } 193 - 194 - indexProperty = { 195 - isRequired: !schema.propertyNames, 196 - name: 'key', 197 - type: 198 - indexPropertyItems.length === 1 199 - ? schemaToType({ 200 - plugin, 201 - schema: indexPropertyItems[0]!, 202 - }) 203 - : schemaToType({ 204 - plugin, 205 - schema: { items: indexPropertyItems, logicalOperator: 'or' }, 206 - }), 207 - }; 208 - 209 - if (schema.propertyNames?.$ref) { 210 - indexKey = schemaToType({ 211 - plugin, 212 - schema: { 213 - $ref: schema.propertyNames.$ref, 214 - }, 215 - }) as ts.TypeReferenceNode; 216 - } 217 - } 218 - 219 - return tsc.typeInterfaceNode({ 220 - indexKey, 221 - indexProperty, 222 - properties: schemaProperties, 223 - useLegacyResolution: false, 224 - }); 225 - }; 226 - 227 - const stringTypeToIdentifier = ({ 228 - plugin, 229 - schema, 230 - }: { 231 - plugin: HeyApiTypeScriptPlugin['Instance']; 232 - schema: SchemaWithType<'string'>; 233 - }): ts.TypeNode => { 234 - if (schema.const !== undefined) { 235 - return tsc.literalTypeNode({ 236 - literal: tsc.stringLiteral({ text: schema.const as string }), 237 - }); 238 - } 239 - 240 - if (schema.format) { 241 - if (schema.format === 'binary') { 242 - return tsc.typeUnionNode({ 243 - types: [ 244 - tsc.typeReferenceNode({ 245 - typeName: 'Blob', 246 - }), 247 - tsc.typeReferenceNode({ 248 - typeName: 'File', 249 - }), 250 - ], 251 - }); 252 - } 253 - 254 - if (schema.format === 'date-time' || schema.format === 'date') { 255 - // TODO: parser - add ability to skip type transformers 256 - if (plugin.getPlugin('@hey-api/transformers')?.config.dates) { 257 - return tsc.typeReferenceNode({ typeName: 'Date' }); 258 - } 259 - } 260 - 261 - if (schema.format === 'typeid' && typeof schema.example === 'string') { 262 - const parts = String(schema.example).split('_'); 263 - parts.pop(); // remove the ID part 264 - const type = parts.join('_'); 265 - 266 - const selector = plugin.api.selector('TypeID', type); 267 - if (!plugin.getSymbol(selector)) { 268 - const selectorTypeId = plugin.api.selector('TypeID'); 269 - 270 - if (!plugin.getSymbol(selectorTypeId)) { 271 - const symbolTypeId = plugin.registerSymbol({ 272 - exported: true, 273 - meta: { 274 - kind: 'type', 275 - }, 276 - name: 'TypeID', 277 - selector: selectorTypeId, 278 - }); 279 - const nodeTypeId = tsc.typeAliasDeclaration({ 280 - exportType: symbolTypeId.exported, 281 - name: symbolTypeId.placeholder, 282 - type: tsc.templateLiteralType({ 283 - value: [ 284 - tsc.typeReferenceNode({ typeName: 'T' }), 285 - '_', 286 - tsc.keywordTypeNode({ keyword: 'string' }), 287 - ], 288 - }), 289 - typeParameters: [ 290 - tsc.typeParameterDeclaration({ 291 - constraint: tsc.keywordTypeNode({ 292 - keyword: 'string', 293 - }), 294 - name: 'T', 295 - }), 296 - ], 297 - }); 298 - plugin.setSymbolValue(symbolTypeId, nodeTypeId); 299 - } 2 + import { handlerV1 } from './v1/plugin'; 300 3 301 - const symbolTypeId = plugin.referenceSymbol(selectorTypeId); 302 - const symbolTypeName = plugin.registerSymbol({ 303 - exported: true, 304 - meta: { 305 - kind: 'type', 306 - }, 307 - name: stringCase({ 308 - case: plugin.config.case, 309 - value: `${type}_id`, 310 - }), 311 - selector, 312 - }); 313 - const node = tsc.typeAliasDeclaration({ 314 - exportType: symbolTypeName.exported, 315 - name: symbolTypeName.placeholder, 316 - type: tsc.typeReferenceNode({ 317 - typeArguments: [ 318 - tsc.literalTypeNode({ 319 - literal: tsc.stringLiteral({ text: type }), 320 - }), 321 - ], 322 - typeName: symbolTypeId.placeholder, 323 - }), 324 - }); 325 - plugin.setSymbolValue(symbolTypeName, node); 326 - } 327 - const symbol = plugin.referenceSymbol(selector); 328 - return tsc.typeReferenceNode({ typeName: symbol.placeholder }); 329 - } 330 - } 331 - 332 - return tsc.keywordTypeNode({ 333 - keyword: 'string', 334 - }); 335 - }; 336 - 337 - const tupleTypeToIdentifier = ({ 338 - plugin, 339 - schema, 340 - }: { 341 - plugin: HeyApiTypeScriptPlugin['Instance']; 342 - schema: SchemaWithType<'tuple'>; 343 - }): ts.TypeNode => { 344 - let itemTypes: Array<ts.Expression | ts.TypeNode> = []; 345 - 346 - if (schema.const && Array.isArray(schema.const)) { 347 - itemTypes = schema.const.map((value) => { 348 - const expression = tsc.valueToExpression({ value }); 349 - return expression ?? tsc.identifier({ text: plugin.config.topType }); 350 - }); 351 - } else if (schema.items) { 352 - for (const item of schema.items) { 353 - const type = schemaToType({ 354 - plugin, 355 - schema: item, 356 - }); 357 - itemTypes.push(type); 358 - } 359 - } 360 - 361 - return tsc.typeTupleNode({ 362 - types: itemTypes, 363 - }); 364 - }; 365 - 366 - const schemaTypeToIdentifier = ({ 367 - plugin, 368 - schema, 369 - }: { 370 - plugin: HeyApiTypeScriptPlugin['Instance']; 371 - schema: IR.SchemaObject; 372 - }): ts.TypeNode => { 373 - const transformersPlugin = plugin.getPlugin('@hey-api/transformers'); 374 - if (transformersPlugin?.config.typeTransformers) { 375 - for (const typeTransformer of transformersPlugin.config.typeTransformers) { 376 - const typeNode = typeTransformer({ schema }); 377 - if (typeNode) { 378 - return typeNode; 379 - } 380 - } 381 - } 382 - 383 - switch (schema.type as Required<IR.SchemaObject>['type']) { 384 - case 'array': 385 - return arrayTypeToIdentifier({ 386 - plugin, 387 - schema: schema as SchemaWithType<'array'>, 388 - }); 389 - case 'boolean': 390 - return booleanTypeToIdentifier({ 391 - schema: schema as SchemaWithType<'boolean'>, 392 - }); 393 - case 'enum': 394 - return enumTypeToIdentifier({ 395 - plugin, 396 - schema: schema as SchemaWithType<'enum'>, 397 - }); 398 - case 'integer': 399 - case 'number': 400 - return numberTypeToIdentifier({ 401 - plugin, 402 - schema: schema as SchemaWithType<'integer' | 'number'>, 403 - }); 404 - case 'never': 405 - return tsc.keywordTypeNode({ 406 - keyword: 'never', 407 - }); 408 - case 'null': 409 - return tsc.literalTypeNode({ 410 - literal: tsc.null(), 411 - }); 412 - case 'object': 413 - return objectTypeToIdentifier({ 414 - plugin, 415 - schema: schema as SchemaWithType<'object'>, 416 - }); 417 - case 'string': 418 - return stringTypeToIdentifier({ 419 - plugin, 420 - schema: schema as SchemaWithType<'string'>, 421 - }); 422 - case 'tuple': 423 - return tupleTypeToIdentifier({ 424 - plugin, 425 - schema: schema as SchemaWithType<'tuple'>, 426 - }); 427 - case 'undefined': 428 - return tsc.keywordTypeNode({ 429 - keyword: 'undefined', 430 - }); 431 - case 'unknown': 432 - return tsc.keywordTypeNode({ 433 - keyword: plugin.config.topType, 434 - }); 435 - case 'void': 436 - return tsc.keywordTypeNode({ 437 - keyword: 'void', 438 - }); 439 - } 440 - }; 441 - 442 - export const schemaToType = ({ 443 - plugin, 444 - schema, 445 - }: { 446 - plugin: HeyApiTypeScriptPlugin['Instance']; 447 - schema: IR.SchemaObject; 448 - }): ts.TypeNode => { 449 - if (schema.$ref) { 450 - const symbol = plugin.referenceSymbol( 451 - plugin.api.selector('ref', schema.$ref), 452 - ); 453 - return tsc.typeReferenceNode({ typeName: symbol.placeholder }); 454 - } 455 - 456 - if (schema.type) { 457 - return schemaTypeToIdentifier({ plugin, schema }); 458 - } 459 - 460 - if (schema.items) { 461 - schema = deduplicateSchema({ detectFormat: false, schema }); 462 - if (schema.items) { 463 - const itemTypes: Array<ts.TypeNode> = []; 464 - 465 - for (const item of schema.items) { 466 - const type = schemaToType({ plugin, schema: item }); 467 - itemTypes.push(type); 468 - } 469 - 470 - return schema.logicalOperator === 'and' 471 - ? tsc.typeIntersectionNode({ types: itemTypes }) 472 - : tsc.typeUnionNode({ types: itemTypes }); 473 - } 474 - 475 - return schemaToType({ plugin, schema }); 476 - } 477 - 478 - // catch-all fallback for failed schemas 479 - return schemaTypeToIdentifier({ 480 - plugin, 481 - schema: { 482 - type: 'unknown', 483 - }, 484 - }); 485 - }; 486 - 487 - const handleComponent = ({ 488 - id, 489 - plugin, 490 - schema, 491 - }: { 492 - id: string; 493 - plugin: HeyApiTypeScriptPlugin['Instance']; 494 - schema: IR.SchemaObject; 495 - }) => { 496 - const type = schemaToType({ plugin, schema }); 497 - 498 - // Don't tag enums as 'type' since they export runtime artifacts (values) 499 - const isEnum = schema.type === 'enum' && plugin.config.enums.enabled; 500 - 501 - const symbol = plugin.registerSymbol({ 502 - exported: true, 503 - meta: { 504 - kind: isEnum ? undefined : 'type', 505 - }, 506 - name: buildName({ 507 - config: plugin.config.definitions, 508 - name: refToName(id), 509 - }), 510 - selector: plugin.api.selector('ref', id), 511 - }); 512 - exportType({ 513 - plugin, 514 - schema, 515 - symbol, 516 - type, 517 - }); 518 - }; 519 - 520 - export const handler: HeyApiTypeScriptPlugin['Handler'] = ({ plugin }) => { 521 - // reserve identifier for ClientOptions 522 - const symbolClientOptions = plugin.registerSymbol({ 523 - exported: true, 524 - meta: { 525 - kind: 'type', 526 - }, 527 - name: buildName({ 528 - config: { 529 - case: plugin.config.case, 530 - }, 531 - name: 'ClientOptions', 532 - }), 533 - selector: plugin.api.selector('ClientOptions'), 534 - }); 535 - // reserve identifier for Webhooks 536 - const symbolWebhooks = plugin.registerSymbol({ 537 - exported: true, 538 - meta: { 539 - kind: 'type', 540 - }, 541 - name: buildName({ 542 - config: { 543 - case: plugin.config.case, 544 - }, 545 - name: 'Webhooks', 546 - }), 547 - selector: plugin.api.selector('Webhooks'), 548 - }); 549 - 550 - const servers: Array<IR.ServerObject> = []; 551 - const webhookNames: Array<string> = []; 552 - 553 - plugin.forEach( 554 - 'operation', 555 - 'parameter', 556 - 'requestBody', 557 - 'schema', 558 - 'server', 559 - 'webhook', 560 - (event) => { 561 - switch (event.type) { 562 - case 'operation': 563 - operationToType({ operation: event.operation, plugin }); 564 - break; 565 - case 'parameter': 566 - handleComponent({ 567 - id: event.$ref, 568 - plugin, 569 - schema: event.parameter.schema, 570 - }); 571 - break; 572 - case 'requestBody': 573 - handleComponent({ 574 - id: event.$ref, 575 - plugin, 576 - schema: event.requestBody.schema, 577 - }); 578 - break; 579 - case 'schema': 580 - handleComponent({ 581 - id: event.$ref, 582 - plugin, 583 - schema: event.schema, 584 - }); 585 - break; 586 - case 'server': 587 - servers.push(event.server); 588 - break; 589 - case 'webhook': 590 - webhookNames.push( 591 - webhookToType({ 592 - operation: event.operation, 593 - plugin, 594 - }), 595 - ); 596 - break; 597 - } 598 - }, 599 - { 600 - order: 'declarations', 601 - }, 602 - ); 603 - 604 - createClientOptions({ plugin, servers, symbolClientOptions }); 605 - createWebhooks({ plugin, symbolWebhooks, webhookNames }); 606 - }; 4 + export const handler: HeyApiTypeScriptPlugin['Handler'] = (args) => 5 + handlerV1(args);
+15
packages/openapi-ts/src/plugins/@hey-api/typescript/shared/types.d.ts
··· 1 + import type { ToRefs } from '~/plugins'; 2 + 3 + import type { HeyApiTypeScriptPlugin } from '../types'; 4 + 5 + export type IrSchemaToAstOptions = { 6 + plugin: HeyApiTypeScriptPlugin['Instance']; 7 + state: ToRefs<PluginState>; 8 + }; 9 + 10 + export type PluginState = { 11 + /** 12 + * Path to the schema in the intermediary representation. 13 + */ 14 + path: ReadonlyArray<string | number>; 15 + };
+1 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts
··· 1 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 2 2 import type { StringCase, StringName } from '~/types/case'; 3 3 4 4 import type { IApi } from './api';
+1
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/api.ts
··· 1 + export { irSchemaToAst as irSchemaToAstV1 } from './plugin';
+210
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/plugin.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import { deduplicateSchema } from '~/ir/schema'; 4 + import type { IR } from '~/ir/types'; 5 + import { buildName } from '~/openApi/shared/utils/name'; 6 + import type { SchemaWithType } from '~/plugins'; 7 + import { toRefs } from '~/plugins/shared/utils/refs'; 8 + import { tsc } from '~/tsc'; 9 + import { refToName } from '~/utils/ref'; 10 + 11 + import { createClientOptions } from '../shared/clientOptions'; 12 + import { exportType } from '../shared/export'; 13 + import { operationToType } from '../shared/operation'; 14 + import type { IrSchemaToAstOptions } from '../shared/types'; 15 + import { webhookToType } from '../shared/webhook'; 16 + import { createWebhooks } from '../shared/webhooks'; 17 + import type { HeyApiTypeScriptPlugin } from '../types'; 18 + import { irSchemaWithTypeToAst } from './toAst'; 19 + 20 + export const irSchemaToAst = ({ 21 + plugin, 22 + schema, 23 + state, 24 + }: IrSchemaToAstOptions & { 25 + schema: IR.SchemaObject; 26 + }): ts.TypeNode => { 27 + if (schema.$ref) { 28 + const symbol = plugin.referenceSymbol( 29 + plugin.api.selector('ref', schema.$ref), 30 + ); 31 + return tsc.typeReferenceNode({ typeName: symbol.placeholder }); 32 + } 33 + 34 + if (schema.type) { 35 + return irSchemaWithTypeToAst({ 36 + plugin, 37 + schema: schema as SchemaWithType, 38 + state, 39 + }); 40 + } 41 + 42 + if (schema.items) { 43 + schema = deduplicateSchema({ detectFormat: false, schema }); 44 + if (schema.items) { 45 + const itemTypes: Array<ts.TypeNode> = []; 46 + 47 + for (const item of schema.items) { 48 + const type = irSchemaToAst({ plugin, schema: item, state }); 49 + itemTypes.push(type); 50 + } 51 + 52 + return schema.logicalOperator === 'and' 53 + ? tsc.typeIntersectionNode({ types: itemTypes }) 54 + : tsc.typeUnionNode({ types: itemTypes }); 55 + } 56 + 57 + return irSchemaToAst({ plugin, schema, state }); 58 + } 59 + 60 + // catch-all fallback for failed schemas 61 + return irSchemaWithTypeToAst({ 62 + plugin, 63 + schema: { 64 + type: 'unknown', 65 + }, 66 + state, 67 + }); 68 + }; 69 + 70 + const handleComponent = ({ 71 + $ref, 72 + plugin, 73 + schema, 74 + state, 75 + }: IrSchemaToAstOptions & { 76 + $ref: string; 77 + schema: IR.SchemaObject; 78 + }) => { 79 + const type = irSchemaToAst({ plugin, schema, state }); 80 + 81 + // Don't tag enums as 'type' since they export runtime artifacts (values) 82 + const isEnum = schema.type === 'enum' && plugin.config.enums.enabled; 83 + 84 + const symbol = plugin.registerSymbol({ 85 + exported: true, 86 + meta: { 87 + kind: isEnum ? undefined : 'type', 88 + path: state.path.value, 89 + }, 90 + name: buildName({ 91 + config: plugin.config.definitions, 92 + name: refToName($ref), 93 + }), 94 + selector: plugin.api.selector('ref', $ref), 95 + }); 96 + exportType({ 97 + plugin, 98 + schema, 99 + symbol, 100 + type, 101 + }); 102 + }; 103 + 104 + export const handlerV1: HeyApiTypeScriptPlugin['Handler'] = ({ plugin }) => { 105 + // reserve identifier for ClientOptions 106 + const symbolClientOptions = plugin.registerSymbol({ 107 + exported: true, 108 + meta: { 109 + kind: 'type', 110 + path: [], 111 + }, 112 + name: buildName({ 113 + config: { 114 + case: plugin.config.case, 115 + }, 116 + name: 'ClientOptions', 117 + }), 118 + selector: plugin.api.selector('ClientOptions'), 119 + }); 120 + // reserve identifier for Webhooks 121 + const symbolWebhooks = plugin.registerSymbol({ 122 + exported: true, 123 + meta: { 124 + kind: 'type', 125 + path: [], 126 + }, 127 + name: buildName({ 128 + config: { 129 + case: plugin.config.case, 130 + }, 131 + name: 'Webhooks', 132 + }), 133 + selector: plugin.api.selector('Webhooks'), 134 + }); 135 + 136 + const servers: Array<IR.ServerObject> = []; 137 + const webhookNames: Array<string> = []; 138 + 139 + plugin.forEach( 140 + 'operation', 141 + 'parameter', 142 + 'requestBody', 143 + 'schema', 144 + 'server', 145 + 'webhook', 146 + (event) => { 147 + switch (event.type) { 148 + case 'operation': 149 + operationToType({ 150 + operation: event.operation, 151 + plugin, 152 + state: toRefs({ 153 + path: event._path, 154 + }), 155 + }); 156 + break; 157 + case 'parameter': 158 + handleComponent({ 159 + $ref: event.$ref, 160 + plugin, 161 + schema: event.parameter.schema, 162 + state: toRefs({ 163 + path: event._path, 164 + }), 165 + }); 166 + break; 167 + case 'requestBody': 168 + handleComponent({ 169 + $ref: event.$ref, 170 + plugin, 171 + schema: event.requestBody.schema, 172 + state: toRefs({ 173 + path: event._path, 174 + }), 175 + }); 176 + break; 177 + case 'schema': 178 + handleComponent({ 179 + $ref: event.$ref, 180 + plugin, 181 + schema: event.schema, 182 + state: toRefs({ 183 + path: event._path, 184 + }), 185 + }); 186 + break; 187 + case 'server': 188 + servers.push(event.server); 189 + break; 190 + case 'webhook': 191 + webhookNames.push( 192 + webhookToType({ 193 + operation: event.operation, 194 + plugin, 195 + state: toRefs({ 196 + path: event._path, 197 + }), 198 + }), 199 + ); 200 + break; 201 + } 202 + }, 203 + { 204 + order: 'declarations', 205 + }, 206 + ); 207 + 208 + createClientOptions({ plugin, servers, symbolClientOptions }); 209 + createWebhooks({ plugin, symbolWebhooks, webhookNames }); 210 + };
+51
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/array.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import { deduplicateSchema } from '~/ir/schema'; 4 + import type { SchemaWithType } from '~/plugins'; 5 + import { toRef } from '~/plugins/shared/utils/refs'; 6 + import { tsc } from '~/tsc'; 7 + 8 + import type { IrSchemaToAstOptions } from '../../shared/types'; 9 + import { irSchemaToAst } from '../plugin'; 10 + 11 + export const arrayToAst = ({ 12 + plugin, 13 + schema, 14 + state, 15 + }: IrSchemaToAstOptions & { 16 + schema: SchemaWithType<'array'>; 17 + }): ts.TypeNode => { 18 + if (!schema.items) { 19 + return tsc.typeArrayNode( 20 + tsc.keywordTypeNode({ keyword: plugin.config.topType }), 21 + ); 22 + } 23 + 24 + schema = deduplicateSchema({ detectFormat: true, schema }); 25 + 26 + const itemTypes: Array<ts.TypeNode> = []; 27 + 28 + if (schema.items) { 29 + schema.items.forEach((item, index) => { 30 + const type = irSchemaToAst({ 31 + plugin, 32 + schema: item, 33 + state: { 34 + ...state, 35 + path: toRef([...state.path.value, 'items', index]), 36 + }, 37 + }); 38 + itemTypes.push(type); 39 + }); 40 + } 41 + 42 + if (itemTypes.length === 1) { 43 + return tsc.typeArrayNode(itemTypes[0]!); 44 + } 45 + 46 + if (schema.logicalOperator === 'and') { 47 + return tsc.typeArrayNode(tsc.typeIntersectionNode({ types: itemTypes })); 48 + } 49 + 50 + return tsc.typeArrayNode(tsc.typeUnionNode({ types: itemTypes })); 51 + };
+22
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/boolean.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { SchemaWithType } from '~/plugins'; 4 + import { tsc } from '~/tsc'; 5 + 6 + import type { IrSchemaToAstOptions } from '../../shared/types'; 7 + 8 + export const booleanToAst = ({ 9 + schema, 10 + }: IrSchemaToAstOptions & { 11 + schema: SchemaWithType<'boolean'>; 12 + }): ts.TypeNode => { 13 + if (schema.const !== undefined) { 14 + return tsc.literalTypeNode({ 15 + literal: tsc.ots.boolean(schema.const as boolean), 16 + }); 17 + } 18 + 19 + return tsc.keywordTypeNode({ 20 + keyword: 'boolean', 21 + }); 22 + };
+24
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/enum.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { SchemaWithType } from '~/plugins'; 4 + 5 + import type { IrSchemaToAstOptions } from '../../shared/types'; 6 + import { irSchemaToAst } from '../plugin'; 7 + 8 + export const enumToAst = ({ 9 + plugin, 10 + schema, 11 + state, 12 + }: IrSchemaToAstOptions & { 13 + schema: SchemaWithType<'enum'>; 14 + }): ts.TypeNode => { 15 + const type = irSchemaToAst({ 16 + plugin, 17 + schema: { 18 + ...schema, 19 + type: undefined, 20 + }, 21 + state, 22 + }); 23 + return type; 24 + };
+98
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/index.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { SchemaWithType } from '~/plugins'; 4 + 5 + import type { IrSchemaToAstOptions } from '../../shared/types'; 6 + import { arrayToAst } from './array'; 7 + import { booleanToAst } from './boolean'; 8 + import { enumToAst } from './enum'; 9 + import { neverToAst } from './never'; 10 + import { nullToAst } from './null'; 11 + import { numberToAst } from './number'; 12 + import { objectToAst } from './object'; 13 + import { stringToAst } from './string'; 14 + import { tupleToAst } from './tuple'; 15 + import { undefinedToAst } from './undefined'; 16 + import { unknownToAst } from './unknown'; 17 + import { voidToAst } from './void'; 18 + 19 + export const irSchemaWithTypeToAst = ({ 20 + schema, 21 + ...args 22 + }: IrSchemaToAstOptions & { 23 + schema: SchemaWithType; 24 + }): ts.TypeNode => { 25 + const transformersPlugin = args.plugin.getPlugin('@hey-api/transformers'); 26 + if (transformersPlugin?.config.typeTransformers) { 27 + for (const typeTransformer of transformersPlugin.config.typeTransformers) { 28 + const typeNode = typeTransformer({ schema }); 29 + if (typeNode) { 30 + return typeNode; 31 + } 32 + } 33 + } 34 + 35 + switch (schema.type) { 36 + case 'array': 37 + return arrayToAst({ 38 + ...args, 39 + schema: schema as SchemaWithType<'array'>, 40 + }); 41 + case 'boolean': 42 + return booleanToAst({ 43 + ...args, 44 + schema: schema as SchemaWithType<'boolean'>, 45 + }); 46 + case 'enum': 47 + return enumToAst({ 48 + ...args, 49 + schema: schema as SchemaWithType<'enum'>, 50 + }); 51 + case 'integer': 52 + case 'number': 53 + return numberToAst({ 54 + ...args, 55 + schema: schema as SchemaWithType<'integer' | 'number'>, 56 + }); 57 + case 'never': 58 + return neverToAst({ 59 + ...args, 60 + schema: schema as SchemaWithType<'never'>, 61 + }); 62 + case 'null': 63 + return nullToAst({ 64 + ...args, 65 + schema: schema as SchemaWithType<'null'>, 66 + }); 67 + case 'object': 68 + return objectToAst({ 69 + ...args, 70 + schema: schema as SchemaWithType<'object'>, 71 + }); 72 + case 'string': 73 + return stringToAst({ 74 + ...args, 75 + schema: schema as SchemaWithType<'string'>, 76 + }); 77 + case 'tuple': 78 + return tupleToAst({ 79 + ...args, 80 + schema: schema as SchemaWithType<'tuple'>, 81 + }); 82 + case 'undefined': 83 + return undefinedToAst({ 84 + ...args, 85 + schema: schema as SchemaWithType<'undefined'>, 86 + }); 87 + case 'unknown': 88 + return unknownToAst({ 89 + ...args, 90 + schema: schema as SchemaWithType<'unknown'>, 91 + }); 92 + case 'void': 93 + return voidToAst({ 94 + ...args, 95 + schema: schema as SchemaWithType<'void'>, 96 + }); 97 + } 98 + };
+18
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/never.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { SchemaWithType } from '~/plugins'; 4 + import { tsc } from '~/tsc'; 5 + 6 + import type { IrSchemaToAstOptions } from '../../shared/types'; 7 + 8 + export const neverToAst = ( 9 + // eslint-disable-next-line @typescript-eslint/no-unused-vars 10 + _args: IrSchemaToAstOptions & { 11 + schema: SchemaWithType<'never'>; 12 + }, 13 + ): ts.TypeNode => { 14 + const node = tsc.keywordTypeNode({ 15 + keyword: 'never', 16 + }); 17 + return node; 18 + };
+18
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/null.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { SchemaWithType } from '~/plugins'; 4 + import { tsc } from '~/tsc'; 5 + 6 + import type { IrSchemaToAstOptions } from '../../shared/types'; 7 + 8 + export const nullToAst = ( 9 + // eslint-disable-next-line @typescript-eslint/no-unused-vars 10 + _args: IrSchemaToAstOptions & { 11 + schema: SchemaWithType<'null'>; 12 + }, 13 + ): ts.TypeNode => { 14 + const node = tsc.literalTypeNode({ 15 + literal: tsc.null(), 16 + }); 17 + return node; 18 + };
+30
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/number.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { SchemaWithType } from '~/plugins'; 4 + import { tsc } from '~/tsc'; 5 + 6 + import type { IrSchemaToAstOptions } from '../../shared/types'; 7 + 8 + export const numberToAst = ({ 9 + plugin, 10 + schema, 11 + }: IrSchemaToAstOptions & { 12 + schema: SchemaWithType<'integer' | 'number'>; 13 + }): ts.TypeNode => { 14 + if (schema.const !== undefined) { 15 + return tsc.literalTypeNode({ 16 + literal: tsc.ots.number(schema.const as number), 17 + }); 18 + } 19 + 20 + if (schema.type === 'integer' && schema.format === 'int64') { 21 + // TODO: parser - add ability to skip type transformers 22 + if (plugin.getPlugin('@hey-api/transformers')?.config.bigInt) { 23 + return tsc.typeReferenceNode({ typeName: 'bigint' }); 24 + } 25 + } 26 + 27 + return tsc.keywordTypeNode({ 28 + keyword: 'number', 29 + }); 30 + };
+131
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/object.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { IR } from '~/ir/types'; 4 + import type { SchemaWithType } from '~/plugins'; 5 + import { fieldName } from '~/plugins/shared/utils/case'; 6 + import { toRef } from '~/plugins/shared/utils/refs'; 7 + import { createSchemaComment } from '~/plugins/shared/utils/schema'; 8 + import type { Property } from '~/tsc'; 9 + import { tsc } from '~/tsc'; 10 + 11 + import type { IrSchemaToAstOptions } from '../../shared/types'; 12 + import { irSchemaToAst } from '../plugin'; 13 + 14 + export const objectToAst = ({ 15 + plugin, 16 + schema, 17 + state, 18 + }: IrSchemaToAstOptions & { 19 + schema: SchemaWithType<'object'>; 20 + }): ts.TypeNode => { 21 + // TODO: parser - handle constants 22 + let indexKey: ts.TypeReferenceNode | undefined; 23 + let indexProperty: Property | undefined; 24 + const schemaProperties: Array<Property> = []; 25 + let indexPropertyItems: Array<IR.SchemaObject> = []; 26 + const required = schema.required ?? []; 27 + let hasOptionalProperties = false; 28 + 29 + for (const name in schema.properties) { 30 + const property = schema.properties[name]!; 31 + const propertyType = irSchemaToAst({ 32 + plugin, 33 + schema: property, 34 + state: { 35 + ...state, 36 + path: toRef([...state.path.value, 'properties', name]), 37 + }, 38 + }); 39 + const isRequired = required.includes(name); 40 + schemaProperties.push({ 41 + comment: createSchemaComment({ schema: property }), 42 + isReadOnly: property.accessScope === 'read', 43 + isRequired, 44 + name: fieldName({ context: plugin.context, name }), 45 + type: propertyType, 46 + }); 47 + indexPropertyItems.push(property); 48 + 49 + if (!isRequired) { 50 + hasOptionalProperties = true; 51 + } 52 + } 53 + 54 + // include pattern value schemas into the index union 55 + if (schema.patternProperties) { 56 + for (const pattern in schema.patternProperties) { 57 + const ir = schema.patternProperties[pattern]!; 58 + indexPropertyItems.unshift(ir); 59 + } 60 + } 61 + 62 + const hasPatterns = 63 + !!schema.patternProperties && 64 + Object.keys(schema.patternProperties).length > 0; 65 + 66 + const addPropsRaw = schema.additionalProperties; 67 + const addPropsObj = 68 + addPropsRaw !== false && addPropsRaw 69 + ? (addPropsRaw as IR.SchemaObject) 70 + : undefined; 71 + const shouldCreateIndex = 72 + hasPatterns || 73 + (!!addPropsObj && 74 + (addPropsObj.type !== 'never' || !indexPropertyItems.length)); 75 + 76 + if (shouldCreateIndex) { 77 + // only inject additionalProperties when it’s not "never" 78 + const addProps = addPropsObj; 79 + if (addProps && addProps.type !== 'never') { 80 + indexPropertyItems.unshift(addProps); 81 + } else if ( 82 + !hasPatterns && 83 + !indexPropertyItems.length && 84 + addProps && 85 + addProps.type === 'never' 86 + ) { 87 + // keep "never" only when there are NO patterns and NO explicit properties 88 + indexPropertyItems = [addProps]; 89 + } 90 + 91 + if (hasOptionalProperties) { 92 + indexPropertyItems.push({ 93 + type: 'undefined', 94 + }); 95 + } 96 + 97 + indexProperty = { 98 + isRequired: !schema.propertyNames, 99 + name: 'key', 100 + type: 101 + indexPropertyItems.length === 1 102 + ? irSchemaToAst({ 103 + plugin, 104 + schema: indexPropertyItems[0]!, 105 + state, 106 + }) 107 + : irSchemaToAst({ 108 + plugin, 109 + schema: { items: indexPropertyItems, logicalOperator: 'or' }, 110 + state, 111 + }), 112 + }; 113 + 114 + if (schema.propertyNames?.$ref) { 115 + indexKey = irSchemaToAst({ 116 + plugin, 117 + schema: { 118 + $ref: schema.propertyNames.$ref, 119 + }, 120 + state, 121 + }) as ts.TypeReferenceNode; 122 + } 123 + } 124 + 125 + return tsc.typeInterfaceNode({ 126 + indexKey, 127 + indexProperty, 128 + properties: schemaProperties, 129 + useLegacyResolution: false, 130 + }); 131 + };
+118
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/string.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { SchemaWithType } from '~/plugins'; 4 + import { tsc } from '~/tsc'; 5 + import { stringCase } from '~/utils/stringCase'; 6 + 7 + import type { IrSchemaToAstOptions } from '../../shared/types'; 8 + 9 + export const stringToAst = ({ 10 + plugin, 11 + schema, 12 + }: IrSchemaToAstOptions & { 13 + schema: SchemaWithType<'string'>; 14 + }): ts.TypeNode => { 15 + if (schema.const !== undefined) { 16 + return tsc.literalTypeNode({ 17 + literal: tsc.stringLiteral({ text: schema.const as string }), 18 + }); 19 + } 20 + 21 + if (schema.format) { 22 + if (schema.format === 'binary') { 23 + return tsc.typeUnionNode({ 24 + types: [ 25 + tsc.typeReferenceNode({ 26 + typeName: 'Blob', 27 + }), 28 + tsc.typeReferenceNode({ 29 + typeName: 'File', 30 + }), 31 + ], 32 + }); 33 + } 34 + 35 + if (schema.format === 'date-time' || schema.format === 'date') { 36 + // TODO: parser - add ability to skip type transformers 37 + if (plugin.getPlugin('@hey-api/transformers')?.config.dates) { 38 + return tsc.typeReferenceNode({ typeName: 'Date' }); 39 + } 40 + } 41 + 42 + if (schema.format === 'typeid' && typeof schema.example === 'string') { 43 + const parts = String(schema.example).split('_'); 44 + parts.pop(); // remove the ID part 45 + const type = parts.join('_'); 46 + 47 + const selector = plugin.api.selector('TypeID', type); 48 + if (!plugin.getSymbol(selector)) { 49 + const selectorTypeId = plugin.api.selector('TypeID'); 50 + 51 + if (!plugin.getSymbol(selectorTypeId)) { 52 + const symbolTypeId = plugin.registerSymbol({ 53 + exported: true, 54 + meta: { 55 + kind: 'type', 56 + path: [], 57 + }, 58 + name: 'TypeID', 59 + selector: selectorTypeId, 60 + }); 61 + const nodeTypeId = tsc.typeAliasDeclaration({ 62 + exportType: symbolTypeId.exported, 63 + name: symbolTypeId.placeholder, 64 + type: tsc.templateLiteralType({ 65 + value: [ 66 + tsc.typeReferenceNode({ typeName: 'T' }), 67 + '_', 68 + tsc.keywordTypeNode({ keyword: 'string' }), 69 + ], 70 + }), 71 + typeParameters: [ 72 + tsc.typeParameterDeclaration({ 73 + constraint: tsc.keywordTypeNode({ 74 + keyword: 'string', 75 + }), 76 + name: 'T', 77 + }), 78 + ], 79 + }); 80 + plugin.setSymbolValue(symbolTypeId, nodeTypeId); 81 + } 82 + 83 + const symbolTypeId = plugin.referenceSymbol(selectorTypeId); 84 + const symbolTypeName = plugin.registerSymbol({ 85 + exported: true, 86 + meta: { 87 + kind: 'type', 88 + path: [], 89 + }, 90 + name: stringCase({ 91 + case: plugin.config.case, 92 + value: `${type}_id`, 93 + }), 94 + selector, 95 + }); 96 + const node = tsc.typeAliasDeclaration({ 97 + exportType: symbolTypeName.exported, 98 + name: symbolTypeName.placeholder, 99 + type: tsc.typeReferenceNode({ 100 + typeArguments: [ 101 + tsc.literalTypeNode({ 102 + literal: tsc.stringLiteral({ text: type }), 103 + }), 104 + ], 105 + typeName: symbolTypeId.placeholder, 106 + }), 107 + }); 108 + plugin.setSymbolValue(symbolTypeName, node); 109 + } 110 + const symbol = plugin.referenceSymbol(selector); 111 + return tsc.typeReferenceNode({ typeName: symbol.placeholder }); 112 + } 113 + } 114 + 115 + return tsc.keywordTypeNode({ 116 + keyword: 'string', 117 + }); 118 + };
+41
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/tuple.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { SchemaWithType } from '~/plugins'; 4 + import { toRef } from '~/plugins/shared/utils/refs'; 5 + import { tsc } from '~/tsc'; 6 + 7 + import type { IrSchemaToAstOptions } from '../../shared/types'; 8 + import { irSchemaToAst } from '../plugin'; 9 + 10 + export const tupleToAst = ({ 11 + plugin, 12 + schema, 13 + state, 14 + }: IrSchemaToAstOptions & { 15 + schema: SchemaWithType<'tuple'>; 16 + }): ts.TypeNode => { 17 + let itemTypes: Array<ts.Expression | ts.TypeNode> = []; 18 + 19 + if (schema.const && Array.isArray(schema.const)) { 20 + itemTypes = schema.const.map((value) => { 21 + const expression = tsc.valueToExpression({ value }); 22 + return expression ?? tsc.identifier({ text: plugin.config.topType }); 23 + }); 24 + } else if (schema.items) { 25 + schema.items.forEach((item, index) => { 26 + const type = irSchemaToAst({ 27 + plugin, 28 + schema: item, 29 + state: { 30 + ...state, 31 + path: toRef([...state.path.value, 'items', index]), 32 + }, 33 + }); 34 + itemTypes.push(type); 35 + }); 36 + } 37 + 38 + return tsc.typeTupleNode({ 39 + types: itemTypes, 40 + }); 41 + };
+18
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/undefined.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { SchemaWithType } from '~/plugins'; 4 + import { tsc } from '~/tsc'; 5 + 6 + import type { IrSchemaToAstOptions } from '../../shared/types'; 7 + 8 + export const undefinedToAst = ( 9 + // eslint-disable-next-line @typescript-eslint/no-unused-vars 10 + _args: IrSchemaToAstOptions & { 11 + schema: SchemaWithType<'undefined'>; 12 + }, 13 + ): ts.TypeNode => { 14 + const node = tsc.keywordTypeNode({ 15 + keyword: 'undefined', 16 + }); 17 + return node; 18 + };
+17
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/unknown.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { SchemaWithType } from '~/plugins'; 4 + import { tsc } from '~/tsc'; 5 + 6 + import type { IrSchemaToAstOptions } from '../../shared/types'; 7 + 8 + export const unknownToAst = ({ 9 + plugin, 10 + }: IrSchemaToAstOptions & { 11 + schema: SchemaWithType<'unknown'>; 12 + }): ts.TypeNode => { 13 + const node = tsc.keywordTypeNode({ 14 + keyword: plugin.config.topType, 15 + }); 16 + return node; 17 + };
+18
packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/void.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { SchemaWithType } from '~/plugins'; 4 + import { tsc } from '~/tsc'; 5 + 6 + import type { IrSchemaToAstOptions } from '../../shared/types'; 7 + 8 + export const voidToAst = ( 9 + // eslint-disable-next-line @typescript-eslint/no-unused-vars 10 + _args: IrSchemaToAstOptions & { 11 + schema: SchemaWithType<'void'>; 12 + }, 13 + ): ts.TypeNode => { 14 + const node = tsc.keywordTypeNode({ 15 + keyword: 'void', 16 + }); 17 + return node; 18 + };
+14 -9
packages/openapi-ts/src/plugins/@hey-api/typescript/webhook.ts packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhook.ts
··· 3 3 import { createSchemaComment } from '~/plugins/shared/utils/schema'; 4 4 import { tsc } from '~/tsc'; 5 5 6 - import { schemaToType } from './plugin'; 7 - import type { HeyApiTypeScriptPlugin } from './types'; 6 + import { irSchemaToAst } from '../v1/plugin'; 7 + import type { IrSchemaToAstOptions } from './types'; 8 8 9 9 const operationToDataType = ({ 10 10 operation, 11 11 plugin, 12 - }: { 12 + state, 13 + }: IrSchemaToAstOptions & { 13 14 operation: IR.OperationObject; 14 - plugin: HeyApiTypeScriptPlugin['Instance']; 15 15 }): string => { 16 16 const data: IR.SchemaObject = { 17 17 type: 'object', ··· 27 27 exported: true, 28 28 meta: { 29 29 kind: 'type', 30 + path: state.path.value, 30 31 }, 31 32 name: buildName({ 32 33 config: { ··· 37 38 }), 38 39 selector: plugin.api.selector('webhook-payload', operation.id), 39 40 }); 40 - const type = schemaToType({ 41 + const type = irSchemaToAst({ 41 42 plugin, 42 43 schema: operation.body.schema, 44 + state, 43 45 }); 44 46 const node = tsc.typeAliasDeclaration({ 45 47 comment: createSchemaComment({ schema: operation.body.schema }), ··· 53 55 exported: true, 54 56 meta: { 55 57 kind: 'type', 58 + path: state.path.value, 56 59 }, 57 60 name: symbolWebhookPayload.name, 58 61 placeholder: symbolWebhookPayload.placeholder, ··· 79 82 exported: true, 80 83 meta: { 81 84 kind: 'type', 85 + path: state.path.value, 82 86 }, 83 87 name: buildName({ 84 88 config: plugin.config.webhooks, ··· 86 90 }), 87 91 selector: plugin.api.selector('webhook-request', operation.id), 88 92 }); 89 - const type = schemaToType({ 93 + const type = irSchemaToAst({ 90 94 plugin, 91 95 schema: data, 96 + state, 92 97 }); 93 98 const node = tsc.typeAliasDeclaration({ 94 99 exportType: symbolWebhookRequest.exported, ··· 103 108 export const webhookToType = ({ 104 109 operation, 105 110 plugin, 106 - }: { 111 + state, 112 + }: IrSchemaToAstOptions & { 107 113 operation: IR.OperationObject; 108 - plugin: HeyApiTypeScriptPlugin['Instance']; 109 114 }): string => { 110 - const name = operationToDataType({ operation, plugin }); 115 + const name = operationToDataType({ operation, plugin, state }); 111 116 return name; 112 117 113 118 // don't handle webhook responses for now, users only need requestBody
+1 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/webhooks.ts packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhooks.ts
··· 2 2 3 3 import { tsc } from '~/tsc'; 4 4 5 - import type { HeyApiTypeScriptPlugin } from './types'; 5 + import type { HeyApiTypeScriptPlugin } from '../types'; 6 6 7 7 export const createWebhooks = ({ 8 8 plugin,
+1 -1
packages/openapi-ts/src/plugins/@pinia/colada/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 6 6 | '_JSONValue'
+1 -1
packages/openapi-ts/src/plugins/@pinia/colada/types.d.ts
··· 1 1 import type { IR } from '~/ir/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 2 + import type { DefinePlugin, Plugin } from '~/plugins'; 3 3 import type { StringCase, StringName } from '~/types/case'; 4 4 5 5 import type { IApi } from './api';
+1 -1
packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 6 6 | 'AxiosError'
+1 -1
packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/types.d.ts
··· 1 1 import type { IR } from '~/ir/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 2 + import type { DefinePlugin, Plugin } from '~/plugins'; 3 3 import type { StringCase, StringName } from '~/types/case'; 4 4 5 5 import type { IApi } from './api';
+5
packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts
··· 270 270 const type = pluginTypeScript.api.schemaToType({ 271 271 plugin: pluginTypeScript, 272 272 schema: pagination.schema, 273 + state: { 274 + path: { 275 + value: [], 276 + }, 277 + }, 273 278 }); 274 279 const typePageParam = `${tsNodeToString({ 275 280 node: type,
+1 -1
packages/openapi-ts/src/plugins/@tanstack/react-query/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 6 6 | 'AxiosError'
+1 -1
packages/openapi-ts/src/plugins/@tanstack/react-query/types.d.ts
··· 1 1 import type { IR } from '~/ir/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 2 + import type { DefinePlugin, Plugin } from '~/plugins'; 3 3 import type { StringCase, StringName } from '~/types/case'; 4 4 5 5 import type { IApi } from './api';
+1 -1
packages/openapi-ts/src/plugins/@tanstack/solid-query/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 6 6 | 'AxiosError'
+1 -1
packages/openapi-ts/src/plugins/@tanstack/solid-query/types.d.ts
··· 1 1 import type { IR } from '~/ir/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 2 + import type { DefinePlugin, Plugin } from '~/plugins'; 3 3 import type { StringCase, StringName } from '~/types/case'; 4 4 5 5 import type { IApi } from './api';
+1 -1
packages/openapi-ts/src/plugins/@tanstack/svelte-query/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 6 6 | 'AxiosError'
+1 -1
packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.d.ts
··· 1 1 import type { IR } from '~/ir/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 2 + import type { DefinePlugin, Plugin } from '~/plugins'; 3 3 import type { StringCase, StringName } from '~/types/case'; 4 4 5 5 import type { IApi } from './api';
+1 -1
packages/openapi-ts/src/plugins/@tanstack/vue-query/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 6 6 | 'AxiosError'
+1 -1
packages/openapi-ts/src/plugins/@tanstack/vue-query/types.d.ts
··· 1 1 import type { IR } from '~/ir/types'; 2 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 2 + import type { DefinePlugin, Plugin } from '~/plugins'; 3 3 import type { StringCase, StringName } from '~/types/case'; 4 4 5 5 import type { IApi } from './api';
+1 -1
packages/openapi-ts/src/plugins/arktype/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 import type ts from 'typescript'; 3 3 4 - import type { Plugin } from '~/plugins/types'; 4 + import type { Plugin } from '~/plugins'; 5 5 6 6 import type { ValidatorArgs } from './shared/types'; 7 7 import { createRequestValidatorV2, createResponseValidatorV2 } from './v2/api';
+1 -1
packages/openapi-ts/src/plugins/arktype/shared/types.d.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 3 import type { IR } from '~/ir/types'; 4 - import type { ToRefs } from '~/plugins/shared/types/refs'; 4 + import type { ToRefs } from '~/plugins'; 5 5 6 6 import type { ArktypePlugin } from '../types'; 7 7
+1 -1
packages/openapi-ts/src/plugins/arktype/types.d.ts
··· 1 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 2 2 import type { StringCase, StringName } from '~/types/case'; 3 3 4 4 import type { IApi } from './api';
+2 -1
packages/openapi-ts/src/plugins/config.ts
··· 1 + import type { Plugin } from '~/plugins'; 1 2 import type { AngularCommonPlugin } from '~/plugins/@angular/common'; 2 3 import { defaultConfig as angularCommon } from '~/plugins/@angular/common'; 3 4 import type { HeyApiClientAngularPlugin } from '~/plugins/@hey-api/client-angular'; ··· 46 47 import { defaultConfig as arktype } from '~/plugins/arktype'; 47 48 import type { FastifyPlugin } from '~/plugins/fastify'; 48 49 import { defaultConfig as fastify } from '~/plugins/fastify'; 49 - import type { Plugin, PluginNames } from '~/plugins/types'; 50 + import type { PluginNames } from '~/plugins/types'; 50 51 import type { ValibotPlugin } from '~/plugins/valibot'; 51 52 import { defaultConfig as valibot } from '~/plugins/valibot'; 52 53 import type { ZodPlugin } from '~/plugins/zod';
+1 -1
packages/openapi-ts/src/plugins/fastify/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 3 - import type { Plugin } from '~/plugins/types'; 3 + import type { Plugin } from '~/plugins'; 4 4 5 5 type SelectorType = 'RouteHandler'; 6 6
+1 -1
packages/openapi-ts/src/plugins/fastify/types.d.ts
··· 1 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 2 2 3 3 import type { IApi } from './api'; 4 4
+3
packages/openapi-ts/src/plugins/index.ts
··· 1 + export type { ToRefs } from './shared/types/refs'; 2 + export type { SchemaWithType } from './shared/types/schema'; 3 + export type { DefinePlugin, Plugin } from './types';
+3 -3
packages/openapi-ts/src/plugins/shared/types/schema.d.ts
··· 1 1 import type { IR } from '~/ir/types'; 2 2 3 - export interface SchemaWithType< 3 + export type SchemaWithType< 4 4 T extends 5 5 Required<IR.SchemaObject>['type'] = Required<IR.SchemaObject>['type'], 6 - > extends Omit<IR.SchemaObject, 'type'> { 6 + > = Omit<IR.SchemaObject, 'type'> & { 7 7 type: Extract<Required<IR.SchemaObject>['type'], T>; 8 - } 8 + };
+1 -1
packages/openapi-ts/src/plugins/shared/utils/config.ts
··· 1 - import type { Plugin } from '~/plugins/types'; 1 + import type { Plugin } from '~/plugins'; 2 2 3 3 export const definePluginConfig = 4 4 <T extends Plugin.Types>(defaultConfig: Plugin.Config<T>) =>
+1 -1
packages/openapi-ts/src/plugins/shared/utils/instance.ts
··· 20 20 import type { IR } from '~/ir/types'; 21 21 import type { OpenApi } from '~/openApi/types'; 22 22 import type { Hooks } from '~/parser/types/hooks'; 23 + import type { Plugin } from '~/plugins'; 23 24 import type { PluginConfigMap } from '~/plugins/config'; 24 - import type { Plugin } from '~/plugins/types'; 25 25 import { jsonPointerToPath } from '~/utils/ref'; 26 26 27 27 import type { WalkEvent } from '../types/instance';
+1 -1
packages/openapi-ts/src/plugins/valibot/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 import type ts from 'typescript'; 3 3 4 - import type { Plugin } from '~/plugins/types'; 4 + import type { Plugin } from '~/plugins'; 5 5 6 6 import type { ValidatorArgs } from './shared/types'; 7 7 import { createRequestValidatorV1, createResponseValidatorV1 } from './v1/api';
+1 -1
packages/openapi-ts/src/plugins/valibot/shared/types.d.ts
··· 1 1 import type { IR } from '~/ir/types'; 2 - import type { ToRefs } from '~/plugins/shared/types/refs'; 2 + import type { ToRefs } from '~/plugins'; 3 3 import type { StringCase, StringName } from '~/types/case'; 4 4 5 5 import type { ValibotPlugin } from '../types';
+1 -1
packages/openapi-ts/src/plugins/valibot/types.d.ts
··· 1 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 2 2 import type { StringCase, StringName } from '~/types/case'; 3 3 4 4 import type { IApi } from './api';
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/plugin.ts
··· 4 4 import { deduplicateSchema } from '~/ir/schema'; 5 5 import type { IR } from '~/ir/types'; 6 6 import { buildName } from '~/openApi/shared/utils/name'; 7 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 7 + import type { SchemaWithType } from '~/plugins'; 8 8 import { toRef, toRefs } from '~/plugins/shared/utils/refs'; 9 9 import { createSchemaComment } from '~/plugins/shared/utils/schema'; 10 10 import { tsc } from '~/tsc';
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 3 import { deduplicateSchema } from '~/ir/schema'; 4 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 4 + import type { SchemaWithType } from '~/plugins'; 5 5 import { toRef } from '~/plugins/shared/utils/refs'; 6 6 import { tsc } from '~/tsc'; 7 7
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/boolean.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import type { IrSchemaToAstOptions } from '../../shared/types';
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/enum.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { tsc } from '~/tsc'; 5 5 6 6 import type { IrSchemaToAstOptions } from '../../shared/types';
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 5 5 import type { IrSchemaToAstOptions } from '../../shared/types'; 6 6 import { arrayToAst } from './array';
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/never.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import type { IrSchemaToAstOptions } from '../../shared/types';
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/null.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import type { IrSchemaToAstOptions } from '../../shared/types';
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { tsc } from '~/tsc'; 5 5 6 6 import {
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts
··· 1 1 import ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { toRef } from '~/plugins/shared/utils/refs'; 5 5 import { tsc } from '~/tsc'; 6 6 import { numberRegExp } from '~/utils/regexp';
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { tsc } from '~/tsc'; 5 5 6 6 import type { IrSchemaToAstOptions } from '../../shared/types';
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { toRef } from '~/plugins/shared/utils/refs'; 3 3 import { tsc } from '~/tsc'; 4 4
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/undefined.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import type { IrSchemaToAstOptions } from '../../shared/types';
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/unknown.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import type { IrSchemaToAstOptions } from '../../shared/types';
+1 -1
packages/openapi-ts/src/plugins/valibot/v1/toAst/void.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import type { IrSchemaToAstOptions } from '../../shared/types';
+1 -1
packages/openapi-ts/src/plugins/zod/api.ts
··· 1 1 import type { Selector } from '@hey-api/codegen-core'; 2 2 import type ts from 'typescript'; 3 3 4 - import type { Plugin } from '~/plugins/types'; 4 + import type { Plugin } from '~/plugins'; 5 5 6 6 import { 7 7 createRequestValidatorMini,
+1 -1
packages/openapi-ts/src/plugins/zod/mini/plugin.ts
··· 1 1 import { deduplicateSchema } from '~/ir/schema'; 2 2 import type { IR } from '~/ir/types'; 3 3 import { buildName } from '~/openApi/shared/utils/name'; 4 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 4 + import type { SchemaWithType } from '~/plugins'; 5 5 import { toRef, toRefs } from '~/plugins/shared/utils/refs'; 6 6 import { tsc } from '~/tsc'; 7 7 import { refToName } from '~/utils/ref';
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 3 import { deduplicateSchema } from '~/ir/schema'; 4 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 4 + import type { SchemaWithType } from '~/plugins'; 5 5 import { toRef } from '~/plugins/shared/utils/refs'; 6 6 import { tsc } from '~/tsc'; 7 7
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/boolean.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/enum.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { tsc } from '~/tsc'; 5 5 6 6 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/index.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 3 3 import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; 4 4 import { arrayToAst } from './array';
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/never.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/null.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/number.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { tsc } from '~/tsc'; 5 5 6 6 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts
··· 1 1 import ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { toRef } from '~/plugins/shared/utils/refs'; 5 5 import { tsc } from '~/tsc'; 6 6 import { numberRegExp } from '~/utils/regexp';
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/string.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { tsc } from '~/tsc'; 5 5 6 6 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { toRef } from '~/plugins/shared/utils/refs'; 5 5 import { tsc } from '~/tsc'; 6 6
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/undefined.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/unknown.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/void.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/shared/types.d.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 3 import type { IR } from '~/ir/types'; 4 - import type { ToRefs } from '~/plugins/shared/types/refs'; 4 + import type { ToRefs } from '~/plugins'; 5 5 6 6 import type { ZodPlugin } from '../types'; 7 7
+1 -1
packages/openapi-ts/src/plugins/zod/types.d.ts
··· 1 - import type { DefinePlugin, Plugin } from '~/plugins/types'; 1 + import type { DefinePlugin, Plugin } from '~/plugins'; 2 2 import type { StringCase, StringName } from '~/types/case'; 3 3 4 4 import type { IApi } from './api';
+1 -1
packages/openapi-ts/src/plugins/zod/v3/plugin.ts
··· 1 1 import { deduplicateSchema } from '~/ir/schema'; 2 2 import type { IR } from '~/ir/types'; 3 3 import { buildName } from '~/openApi/shared/utils/name'; 4 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 4 + import type { SchemaWithType } from '~/plugins'; 5 5 import { toRef, toRefs } from '~/plugins/shared/utils/refs'; 6 6 import { tsc } from '~/tsc'; 7 7 import { refToName } from '~/utils/ref';
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 3 import { deduplicateSchema } from '~/ir/schema'; 4 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 4 + import type { SchemaWithType } from '~/plugins'; 5 5 import { toRef } from '~/plugins/shared/utils/refs'; 6 6 import { tsc } from '~/tsc'; 7 7
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/boolean.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/enum.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { tsc } from '~/tsc'; 5 5 6 6 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/index.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 3 3 import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; 4 4 import { arrayToAst } from './array';
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/never.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/null.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/number.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts
··· 1 1 import ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { toRef } from '~/plugins/shared/utils/refs'; 5 5 import { tsc } from '~/tsc'; 6 6 import { numberRegExp } from '~/utils/regexp';
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/string.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { toRef } from '~/plugins/shared/utils/refs'; 5 5 import { tsc } from '~/tsc'; 6 6
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/undefined.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/unknown.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/void.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v4/plugin.ts
··· 1 1 import { deduplicateSchema } from '~/ir/schema'; 2 2 import type { IR } from '~/ir/types'; 3 3 import { buildName } from '~/openApi/shared/utils/name'; 4 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 4 + import type { SchemaWithType } from '~/plugins'; 5 5 import { toRef, toRefs } from '~/plugins/shared/utils/refs'; 6 6 import { tsc } from '~/tsc'; 7 7 import { refToName } from '~/utils/ref';
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 3 import { deduplicateSchema } from '~/ir/schema'; 4 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 4 + import type { SchemaWithType } from '~/plugins'; 5 5 import { toRef } from '~/plugins/shared/utils/refs'; 6 6 import { tsc } from '~/tsc'; 7 7
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/boolean.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/enum.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { tsc } from '~/tsc'; 5 5 6 6 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/index.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 3 3 import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; 4 4 import { arrayToAst } from './array';
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/never.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/null.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/number.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts
··· 1 1 import ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { toRef } from '~/plugins/shared/utils/refs'; 5 5 import { tsc } from '~/tsc'; 6 6 import { numberRegExp } from '~/utils/regexp';
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/string.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts
··· 1 1 import type ts from 'typescript'; 2 2 3 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 3 + import type { SchemaWithType } from '~/plugins'; 4 4 import { toRef } from '~/plugins/shared/utils/refs'; 5 5 import { tsc } from '~/tsc'; 6 6
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/undefined.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/unknown.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+1 -1
packages/openapi-ts/src/plugins/zod/v4/toAst/void.ts
··· 1 - import type { SchemaWithType } from '~/plugins/shared/types/schema'; 1 + import type { SchemaWithType } from '~/plugins'; 2 2 import { tsc } from '~/tsc'; 3 3 4 4 import { identifiers } from '../../constants';
+2 -1
packages/openapi-ts/src/types/config.d.ts
··· 1 + import type { Plugin } from '~/plugins'; 1 2 import type { PluginConfigMap } from '~/plugins/config'; 2 - import type { Plugin, PluginNames } from '~/plugins/types'; 3 + import type { PluginNames } from '~/plugins/types'; 3 4 4 5 import type { Input, UserInput, Watch } from './input'; 5 6 import type { Logs } from './logs';