@povio/openapi-codegen-cli 0.2.8 → 0.3.0
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/commands/generate.d.ts +2 -1
- package/dist/generators/types/metadata.d.ts +13 -13
- package/dist/generators/utils/generate/generate.imports.utils.d.ts +1 -1
- package/dist/generators/utils/ts.utils.d.ts +4 -4
- package/dist/index.js +12 -12
- package/dist/sh.js +49 -49
- package/package.json +1 -1
- package/src/generators/templates/partials/query-use-mutation.hbs +1 -1
|
@@ -2,6 +2,7 @@ export type GenerateParams = {
|
|
|
2
2
|
input: string;
|
|
3
3
|
output: string;
|
|
4
4
|
includeNamespaces: boolean;
|
|
5
|
+
useRelativeImports: boolean;
|
|
5
6
|
splitByTags: boolean;
|
|
6
7
|
defaultTag: string;
|
|
7
8
|
excludeTags: string;
|
|
@@ -9,4 +10,4 @@ export type GenerateParams = {
|
|
|
9
10
|
prettier: boolean;
|
|
10
11
|
verbose: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare function generate({ input, output, includeNamespaces, splitByTags, defaultTag, excludeTags, removeOperationPrefixEndingWith, prettier, verbose, }: GenerateParams): Promise<void>;
|
|
13
|
+
export declare function generate({ input, output, includeNamespaces, useRelativeImports, splitByTags, defaultTag, excludeTags, removeOperationPrefixEndingWith, prettier, verbose, }: GenerateParams): Promise<void>;
|
|
@@ -4,45 +4,45 @@ export interface GenerateMetadataParams {
|
|
|
4
4
|
input: string;
|
|
5
5
|
options?: Partial<GenerateOptions>;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface TsTypeBase {
|
|
8
8
|
type: string;
|
|
9
9
|
namespace?: string;
|
|
10
10
|
filePath?: string;
|
|
11
11
|
}
|
|
12
|
-
export type
|
|
13
|
-
export type
|
|
12
|
+
export type TsType = TsTypeBase & TsMetaType;
|
|
13
|
+
export type TsPropertyBase = {
|
|
14
14
|
name: string;
|
|
15
15
|
isRequired: boolean;
|
|
16
|
-
} &
|
|
17
|
-
export type
|
|
16
|
+
} & TsTypeBase;
|
|
17
|
+
export type TsProperty = TsPropertyBase & TsMetaType;
|
|
18
18
|
export interface TsPrimitiveMetaType {
|
|
19
19
|
metaType: "primitive";
|
|
20
20
|
}
|
|
21
21
|
export interface TsObjectMetaType {
|
|
22
22
|
metaType: "object";
|
|
23
|
-
objectProperties:
|
|
23
|
+
objectProperties: TsProperty[];
|
|
24
24
|
isCircular?: boolean;
|
|
25
25
|
}
|
|
26
26
|
export interface TsArrayMetaType {
|
|
27
27
|
metaType: "array";
|
|
28
|
-
arrayType:
|
|
28
|
+
arrayType: TsType;
|
|
29
29
|
}
|
|
30
30
|
export interface TsCompositeMetaType {
|
|
31
31
|
metaType: "composite";
|
|
32
|
-
allOf?:
|
|
33
|
-
oneOf?:
|
|
34
|
-
anyOf?:
|
|
32
|
+
allOf?: TsType[];
|
|
33
|
+
oneOf?: TsType[];
|
|
34
|
+
anyOf?: TsType[];
|
|
35
35
|
}
|
|
36
36
|
export type TsMetaType = TsPrimitiveMetaType | TsObjectMetaType | TsArrayMetaType | TsCompositeMetaType;
|
|
37
|
-
export type ModelMetadata =
|
|
37
|
+
export type ModelMetadata = TsType;
|
|
38
38
|
export type QueryMetadata = {
|
|
39
39
|
name: string;
|
|
40
40
|
filePath: string;
|
|
41
41
|
namespace?: string;
|
|
42
42
|
isQuery: boolean;
|
|
43
43
|
isMutation: boolean;
|
|
44
|
-
params:
|
|
45
|
-
response:
|
|
44
|
+
params: TsProperty[];
|
|
45
|
+
response: TsType;
|
|
46
46
|
};
|
|
47
47
|
export interface GenerateMetadata {
|
|
48
48
|
openApiDoc: OpenAPIV3.Document;
|
|
@@ -14,4 +14,4 @@ export declare function getEndpointsImports({ tag, endpoints, options, }: {
|
|
|
14
14
|
endpoints: Endpoint[];
|
|
15
15
|
options: GenerateOptions;
|
|
16
16
|
}): Import[];
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function getImportPath(options: Pick<GenerateOptions, "output" | "useRelativeImports">): string;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
2
|
import { SchemaResolver } from "../core/SchemaResolver.class";
|
|
3
|
-
import { TsMetaType,
|
|
3
|
+
import { TsMetaType, TsTypeBase } 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 getTsTypeBase({ zodSchemaName, schema, resolver, options, }: {
|
|
8
8
|
zodSchemaName?: string;
|
|
9
9
|
schema?: OpenAPIV3.SchemaObject;
|
|
10
10
|
resolver: SchemaResolver;
|
|
11
11
|
options: GenerateOptions;
|
|
12
|
-
}):
|
|
12
|
+
}): TsTypeBase;
|
|
13
13
|
export declare function getSchemaTsMetaType({ schema, isCircular, parentTypes, resolver, options, }: {
|
|
14
14
|
schema?: OpenAPIV3.SchemaObject;
|
|
15
15
|
isCircular?: boolean;
|
|
16
|
-
parentTypes:
|
|
16
|
+
parentTypes: TsTypeBase[];
|
|
17
17
|
resolver: SchemaResolver;
|
|
18
18
|
options: GenerateOptions;
|
|
19
19
|
}): TsMetaType;
|