Skip to content

Commit d706e87

Browse files
committed
remove useless stuff
1 parent fbdf928 commit d706e87

File tree

2 files changed

+2
-37
lines changed

2 files changed

+2
-37
lines changed

packages/openapi-typescript/src/index.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import transformResponseObject from "./transform/response-object.js";
1212
import transformSchemaObject from "./transform/schema-object.js";
1313
import transformSchemaObjectMap from "./transform/schema-object-map.js";
1414
import { error, escObjKey, getDefaultFetch, getEntries, getSchemaObjectComment, indent } from "./utils.js";
15-
import transformComponentsObjectToTypes from "./transform/components-types.js";
1615
export * from "./types.js"; // expose all types to consumers
1716

1817
const EMPTY_OBJECT_RE = /^\s*\{?\s*\}?\s*$/;
@@ -120,10 +119,6 @@ async function openapiTS(schema: string | URL | OpenAPI3 | Readable, options: Op
120119
// 2c. root schema
121120
const typedComponents = (allSchemas["."].schema as OpenAPI3).components!;
122121

123-
const schemasExportedTypes = options.rootTypes ? transformComponentsObjectToTypes(typedComponents, ctx) : "";
124-
125-
const rootTypes = transformSchema(allSchemas["."].schema as OpenAPI3, ctx);
126-
127122
if (options.rootTypes) {
128123
for (const schema of Object.keys(typedComponents.schemas as object)) {
129124
output.push(`export type ${schema} = components["schema"]["${schema}"];\n`);
@@ -260,7 +255,7 @@ async function openapiTS(schema: string | URL | OpenAPI3 | Readable, options: Op
260255
"type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };",
261256
"type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;",
262257
"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+
"",
264259
);
265260
}
266261

@@ -269,8 +264,7 @@ async function openapiTS(schema: string | URL | OpenAPI3 | Readable, options: Op
269264
output.splice(1, 0, "/** WithRequired type helpers */", "type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };", "");
270265
}
271266

272-
return output.join("\n").concat(schemasExportedTypes);
273-
// return output.join("\n");
267+
return output.join("\n");
274268
}
275269

276270
export default openapiTS;

packages/openapi-typescript/src/transform/components-types.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)