@@ -12,7 +12,6 @@ import transformResponseObject from "./transform/response-object.js";
12
12
import transformSchemaObject from "./transform/schema-object.js" ;
13
13
import transformSchemaObjectMap from "./transform/schema-object-map.js" ;
14
14
import { error , escObjKey , getDefaultFetch , getEntries , getSchemaObjectComment , indent } from "./utils.js" ;
15
- import transformComponentsObjectToTypes from "./transform/components-types.js" ;
16
15
export * from "./types.js" ; // expose all types to consumers
17
16
18
17
const EMPTY_OBJECT_RE = / ^ \s * \{ ? \s * \} ? \s * $ / ;
@@ -120,10 +119,6 @@ async function openapiTS(schema: string | URL | OpenAPI3 | Readable, options: Op
120
119
// 2c. root schema
121
120
const typedComponents = ( allSchemas [ "." ] . schema as OpenAPI3 ) . components ! ;
122
121
123
- const schemasExportedTypes = options . rootTypes ? transformComponentsObjectToTypes ( typedComponents , ctx ) : "" ;
124
-
125
- const rootTypes = transformSchema ( allSchemas [ "." ] . schema as OpenAPI3 , ctx ) ;
126
-
127
122
if ( options . rootTypes ) {
128
123
for ( const schema of Object . keys ( typedComponents . schemas as object ) ) {
129
124
output . push ( `export type ${ schema } = components["schema"]["${ schema } "];\n` ) ;
@@ -260,7 +255,7 @@ async function openapiTS(schema: string | URL | OpenAPI3 | Readable, options: Op
260
255
"type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };" ,
261
256
"type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;" ,
262
257
"type OneOf<T extends any[]> = T extends [infer Only] ? Only : T extends [infer A, infer B, ...infer Rest] ? OneOf<[XOR<A, B>, ...Rest]> : never;" ,
263
- ""
258
+ "" ,
264
259
) ;
265
260
}
266
261
@@ -269,8 +264,7 @@ async function openapiTS(schema: string | URL | OpenAPI3 | Readable, options: Op
269
264
output . splice ( 1 , 0 , "/** WithRequired type helpers */" , "type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };" , "" ) ;
270
265
}
271
266
272
- return output . join ( "\n" ) . concat ( schemasExportedTypes ) ;
273
- // return output.join("\n");
267
+ return output . join ( "\n" ) ;
274
268
}
275
269
276
270
export default openapiTS ;
0 commit comments