Skip to content

Commit 81d8dab

Browse files
committed
fix: better typings for swagger schemas in codegen config
1 parent e2c75db commit 81d8dab

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

.changeset/mighty-mice-yawn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"swagger-typescript-api": patch
3+
---
4+
5+
better typings for swaggerSchema, originalSchema and resolvedSwaggerSchema

types/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import type { PartialDeep } from "type-fest";
22
import type { ComponentTypeNameResolver } from "../src/component-type-name-resolver.js";
33
import type * as CONSTANTS from "../src/constants.js";
4-
import type { RefDetails } from "../src/resolved-swagger-schema.js";
4+
import type {
5+
RefDetails,
6+
ResolvedSwaggerSchema,
7+
} from "../src/resolved-swagger-schema.js";
58
import type { MonoSchemaParser } from "../src/schema-parser/mono-schema-parser.js";
69
import type { Translator } from "../src/translators/translator.js";
10+
import type { OpenAPI } from "openapi-types";
711

812
export type HttpClientType =
913
(typeof CONSTANTS.HTTP_CLIENT)[keyof typeof CONSTANTS.HTTP_CLIENT];
@@ -526,9 +530,11 @@ export interface GenerateApiConfiguration {
526530
/** generate all "enum" types as union types (T1 | T2 | TN) */
527531
generateUnionEnums: boolean;
528532
/** parsed swagger schema */
529-
swaggerSchema: object;
533+
swaggerSchema: OpenAPI.Document;
530534
/** original swagger schema */
531-
originalSchema: object;
535+
originalSchema: OpenAPI.Document;
536+
/** original class container for current schema use */
537+
resolvedSwaggerSchema?: ResolvedSwaggerSchema;
532538
/** map of schema component references */
533539
componentsMap: Record<string, SchemaComponent>;
534540
/** flag indicating the schema was converted from Swagger 2.0 */

0 commit comments

Comments
 (0)