@povio/openapi-codegen-cli 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,7 +7,7 @@ export declare class SchemaResolver {
|
|
|
7
7
|
private options;
|
|
8
8
|
private schemaData;
|
|
9
9
|
private zodSchemaData;
|
|
10
|
-
private
|
|
10
|
+
private compositeZodSchemaData;
|
|
11
11
|
readonly dependencyGraph: ReturnType<typeof getOpenAPISchemaDependencyGraph>;
|
|
12
12
|
private get docSchemas();
|
|
13
13
|
private get schemaRefs();
|
|
@@ -17,12 +17,13 @@ export declare class SchemaResolver {
|
|
|
17
17
|
getRefByZodSchemaName(zodSchemaName: string): string | undefined;
|
|
18
18
|
getTagByZodSchemaName(zodSchemaName: string): string;
|
|
19
19
|
getCodeByZodSchemaName(name: string): string | undefined;
|
|
20
|
-
|
|
20
|
+
getZodSchemaNamesByCompositeCode(code: string): string[] | undefined;
|
|
21
21
|
setZodSchema(name: string, code: string, tag: string): void;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
addZodSchemaForCompositeCode(code: string, zodSchema: ZodSchema, zodSchemaName: string, schema?: OpenAPIV3.SchemaObject): void;
|
|
23
|
+
getCompositeZodSchemaByZodSchemaName(zodSchemaName: string): ZodSchema | undefined;
|
|
24
|
+
getSchemaByCompositeZodSchemaName(compositeZodSchemaName: string): OpenAPIV3.SchemaObject | undefined;
|
|
25
25
|
getZodSchemas(): {};
|
|
26
|
+
resolveObject<T>(obj: OpenAPIV3.ReferenceObject | T): T;
|
|
26
27
|
private intializeSchemaInfo;
|
|
27
28
|
private initializeSchemaTags;
|
|
28
29
|
}
|
|
@@ -4,27 +4,36 @@ export interface GenerateMetadataParams {
|
|
|
4
4
|
input: string;
|
|
5
5
|
options?: Partial<GenerateOptions>;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export interface TsType {
|
|
8
8
|
type: string;
|
|
9
9
|
namespace?: string;
|
|
10
10
|
filePath?: string;
|
|
11
|
-
}
|
|
12
|
-
export type TsNestedType = TsType &
|
|
11
|
+
}
|
|
12
|
+
export type TsNestedType = TsType & TsMetaType;
|
|
13
13
|
export type TsProperty = {
|
|
14
14
|
name: string;
|
|
15
15
|
isRequired: boolean;
|
|
16
16
|
} & TsType;
|
|
17
|
-
export type TsNestedProperty = TsProperty &
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
17
|
+
export type TsNestedProperty = TsProperty & TsMetaType;
|
|
18
|
+
export interface TsPrimitiveMetaType {
|
|
19
|
+
metaType: "primitive";
|
|
20
|
+
}
|
|
21
|
+
export interface TsObjectMetaType {
|
|
22
|
+
metaType: "object";
|
|
22
23
|
objectProperties: TsNestedProperty[];
|
|
23
24
|
isCircular?: boolean;
|
|
24
|
-
}
|
|
25
|
-
|
|
25
|
+
}
|
|
26
|
+
export interface TsArrayMetaType {
|
|
27
|
+
metaType: "array";
|
|
26
28
|
arrayType: TsNestedType;
|
|
27
|
-
}
|
|
29
|
+
}
|
|
30
|
+
export interface TsCompositeMetaType {
|
|
31
|
+
metaType: "composite";
|
|
32
|
+
allOf?: TsNestedType[];
|
|
33
|
+
oneOf?: TsNestedType[];
|
|
34
|
+
anyOf?: TsNestedType[];
|
|
35
|
+
}
|
|
36
|
+
export type TsMetaType = TsPrimitiveMetaType | TsObjectMetaType | TsArrayMetaType | TsCompositeMetaType;
|
|
28
37
|
export type ModelMetadata = TsNestedType;
|
|
29
38
|
export type QueryMetadata = {
|
|
30
39
|
name: string;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
2
|
import { SchemaResolver } from "../core/SchemaResolver.class";
|
|
3
|
-
import {
|
|
3
|
+
import { TsMetaType, TsType } from "../types/metadata";
|
|
4
4
|
import { PrimitiveType } from "../types/openapi";
|
|
5
5
|
import { GenerateOptions } from "../types/options";
|
|
6
6
|
export declare function primitiveTypeToTsType(type: PrimitiveType): string;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function getTsType({ zodSchemaName, schema, resolver, options, }: {
|
|
8
8
|
zodSchemaName?: string;
|
|
9
9
|
schema?: OpenAPIV3.SchemaObject;
|
|
10
10
|
resolver: SchemaResolver;
|
|
11
11
|
options: GenerateOptions;
|
|
12
12
|
}): TsType;
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function getSchemaTsMetaType({ schema, isCircular, parentTypes, resolver, options, }: {
|
|
14
14
|
schema?: OpenAPIV3.SchemaObject;
|
|
15
15
|
isCircular?: boolean;
|
|
16
16
|
parentTypes: TsType[];
|
|
17
17
|
resolver: SchemaResolver;
|
|
18
18
|
options: GenerateOptions;
|
|
19
|
-
}):
|
|
19
|
+
}): TsMetaType;
|