@povio/openapi-codegen-cli 0.2.5 → 0.2.7
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.
- package/dist/generators/types/metadata.d.ts +21 -10
- package/dist/generators/utils/generate/generate.endpoints.utils.d.ts +0 -1
- package/dist/generators/utils/openapi.utils.d.ts +1 -1
- package/dist/generators/utils/ts.utils.d.ts +12 -4
- package/dist/index.js +40 -40
- package/dist/sh.js +56 -56
- package/package.json +1 -1
|
@@ -4,25 +4,36 @@ export interface GenerateMetadataParams {
|
|
|
4
4
|
input: string;
|
|
5
5
|
options?: Partial<GenerateOptions>;
|
|
6
6
|
}
|
|
7
|
-
export type
|
|
8
|
-
name: string;
|
|
7
|
+
export type TsType = {
|
|
9
8
|
type: string;
|
|
10
|
-
required: boolean;
|
|
11
9
|
namespace?: string;
|
|
12
10
|
filePath?: string;
|
|
13
11
|
};
|
|
14
|
-
export
|
|
12
|
+
export type TsNestedType = TsType & TsNestedDataType;
|
|
13
|
+
export type TsProperty = {
|
|
14
|
+
name: string;
|
|
15
|
+
isRequired: boolean;
|
|
16
|
+
} & TsType;
|
|
17
|
+
export type TsNestedProperty = TsProperty & TsNestedDataType;
|
|
18
|
+
export type TsNestedDataType = {
|
|
19
|
+
dataType: "primitive";
|
|
20
|
+
} | {
|
|
21
|
+
dataType: "object";
|
|
22
|
+
objectProperties: TsNestedProperty[];
|
|
23
|
+
isCircular?: boolean;
|
|
24
|
+
} | {
|
|
25
|
+
dataType: "array";
|
|
26
|
+
arrayType: TsNestedType;
|
|
27
|
+
};
|
|
28
|
+
export type ModelMetadata = TsNestedType;
|
|
29
|
+
export type QueryMetadata = {
|
|
15
30
|
name: string;
|
|
16
31
|
filePath: string;
|
|
17
32
|
namespace?: string;
|
|
18
|
-
}
|
|
19
|
-
export type ModelMetadata = BaseMetadata & {
|
|
20
|
-
properties: TsFieldDescriptor[];
|
|
21
|
-
};
|
|
22
|
-
export type QueryMetadata = BaseMetadata & {
|
|
23
33
|
isQuery: boolean;
|
|
24
34
|
isMutation: boolean;
|
|
25
|
-
params:
|
|
35
|
+
params: TsNestedProperty[];
|
|
36
|
+
response: TsNestedType;
|
|
26
37
|
};
|
|
27
38
|
export interface GenerateMetadata {
|
|
28
39
|
openApiDoc: OpenAPIV3.Document;
|
|
@@ -15,7 +15,6 @@ export declare function mapEndpointParamsToFunctionParams({ resolver, endpoint,
|
|
|
15
15
|
type: string;
|
|
16
16
|
paramType: "Query" | "Body" | "Header" | "Path";
|
|
17
17
|
required: boolean;
|
|
18
|
-
tag: string | undefined;
|
|
19
18
|
}[];
|
|
20
19
|
export declare function getEndpointConfig(endpoint: Endpoint): {
|
|
21
20
|
headers?: {
|
|
@@ -33,6 +33,6 @@ export declare function getUniqueOperationName({ path, method, operation, openAp
|
|
|
33
33
|
}): string;
|
|
34
34
|
export declare function formatTag(tag: string): string;
|
|
35
35
|
export declare function getOperationTag(operation: OpenAPIV3.OperationObject, options: GenerateOptions): string;
|
|
36
|
-
/** @example turns `/media-objects/{id}` into `
|
|
36
|
+
/** @example turns `/media-objects/{id}` into `MediaObjectsById` */
|
|
37
37
|
export declare function pathToVariableName(path: string): string;
|
|
38
38
|
export declare function replaceHyphenatedPath(path: string): string;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
2
|
import { SchemaResolver } from "../core/SchemaResolver.class";
|
|
3
|
-
import {
|
|
3
|
+
import { TsNestedDataType, 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
|
|
8
|
-
|
|
7
|
+
export declare function getTypeInfo({ zodSchemaName, schema, resolver, options, }: {
|
|
8
|
+
zodSchemaName?: string;
|
|
9
|
+
schema?: OpenAPIV3.SchemaObject;
|
|
9
10
|
resolver: SchemaResolver;
|
|
10
11
|
options: GenerateOptions;
|
|
11
|
-
}):
|
|
12
|
+
}): TsType;
|
|
13
|
+
export declare function getSchemaTsNestedDataType({ schema, isCircular, parentTypes, resolver, options, }: {
|
|
14
|
+
schema?: OpenAPIV3.SchemaObject;
|
|
15
|
+
isCircular?: boolean;
|
|
16
|
+
parentTypes: TsType[];
|
|
17
|
+
resolver: SchemaResolver;
|
|
18
|
+
options: GenerateOptions;
|
|
19
|
+
}): TsNestedDataType;
|