@povio/openapi-codegen-cli 0.5.3 → 0.5.5
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/core/SchemaResolver.class.d.ts +3 -0
- package/dist/generators/types/generate.d.ts +7 -0
- package/dist/generators/utils/generate/generate.openapi.utils.d.ts +2 -0
- package/dist/generators/utils/generate/generate.zod.utils.d.ts +9 -1
- package/dist/generators/utils/openapi.utils.d.ts +5 -3
- package/dist/generators/utils/string.utils.d.ts +1 -0
- package/dist/index.js +46 -46
- package/dist/sh.js +66 -66
- package/package.json +1 -1
- package/src/generators/templates/models.hbs +4 -2
- package/src/generators/templates/partials/model-js-docs.hbs +6 -0
- package/src/generators/templates/partials/query-use-mutation.hbs +3 -0
- package/src/generators/templates/partials/query-use-query.hbs +2 -0
|
@@ -18,6 +18,7 @@ export interface EnumZodSchemaData {
|
|
|
18
18
|
zodSchemaNameSegments: string[][];
|
|
19
19
|
tags: string[];
|
|
20
20
|
schemaRefs: string[];
|
|
21
|
+
schemas: (OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject)[];
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
export declare class SchemaResolver {
|
|
@@ -46,6 +47,7 @@ export declare class SchemaResolver {
|
|
|
46
47
|
getCompositeZodSchemaByZodSchemaName(zodSchemaName: string): ZodSchema | undefined;
|
|
47
48
|
getSchemaByCompositeZodSchemaName(compositeZodSchemaName: string): OpenAPIV3.SchemaObject | undefined;
|
|
48
49
|
getEnumZodSchemaDataByCode(code: string): EnumZodSchemaData | undefined;
|
|
50
|
+
getEnumZodSchemaDataByName(enumZodSchemaName: string): EnumZodSchemaData | undefined;
|
|
49
51
|
getEnumZodSchemaNamesReferencedBySchemaRef(schemaRef: string): string[];
|
|
50
52
|
getZodSchemas(): {};
|
|
51
53
|
getEnumZodSchemas(): {};
|
|
@@ -53,6 +55,7 @@ export declare class SchemaResolver {
|
|
|
53
55
|
isSchemaCircular(ref: string): boolean;
|
|
54
56
|
getCircularSchemaChain(ref: string, currentRef?: string, chain?: never[]): string[];
|
|
55
57
|
getBaseUrl(): string;
|
|
58
|
+
getZodSchemaObj(zodSchemaName: string): OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject | undefined;
|
|
56
59
|
private initialize;
|
|
57
60
|
}
|
|
58
61
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OpenAPIV3 } from "openapi-types";
|
|
1
2
|
import { SchemaResolver } from "../core/SchemaResolver.class";
|
|
2
3
|
import { Endpoint } from "./endpoint";
|
|
3
4
|
export interface Import {
|
|
@@ -8,6 +9,12 @@ export interface GenerateFile {
|
|
|
8
9
|
fileName: string;
|
|
9
10
|
extension: string;
|
|
10
11
|
}
|
|
12
|
+
export interface GenerateZodSchemaData {
|
|
13
|
+
code: string;
|
|
14
|
+
isCiruclar: boolean;
|
|
15
|
+
isEnum: boolean;
|
|
16
|
+
schemaObj?: OpenAPIV3.SchemaObject;
|
|
17
|
+
}
|
|
11
18
|
export declare enum GenerateType {
|
|
12
19
|
Models = "models",
|
|
13
20
|
Endpoints = "endpoints",
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { SchemaResolver } from "src/generators/core/SchemaResolver.class";
|
|
2
|
+
import { GenerateZodSchemaData } from "src/generators/types/generate";
|
|
2
3
|
import { GenerateOptions } from "src/generators/types/options";
|
|
4
|
+
import { OpenAPIV3 } from "openapi-types";
|
|
3
5
|
export declare const getZodSchemaInferedTypeName: (zodSchemaName: string, options: GenerateOptions) => string;
|
|
4
6
|
export declare const getImportedZodSchemaName: (resolver: SchemaResolver, zodSchemaName: string) => string;
|
|
5
|
-
export declare const getImportedZodSchemaInferedTypeName: (resolver: SchemaResolver, zodSchemaName: string) => string;
|
|
7
|
+
export declare const getImportedZodSchemaInferedTypeName: (resolver: SchemaResolver, zodSchemaName: string, currentTag?: string) => string;
|
|
8
|
+
export declare function getZodSchemaType(data: GenerateZodSchemaData): OpenAPIV3.NonArraySchemaObjectType | "array" | "enum";
|
|
9
|
+
export declare function getZodSchemaDescription(data: GenerateZodSchemaData): (string | undefined)[] | undefined;
|
|
10
|
+
export declare function getZodSchemaPropertyDescriptions(resolver: SchemaResolver, data: GenerateZodSchemaData, tag: string): never[] | Record<string, {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
}>;
|
|
@@ -17,14 +17,16 @@ export declare function isParamMediaTypeAllowed(mediaType: string): mediaType is
|
|
|
17
17
|
export declare function isMainResponseStatus(status: number): boolean;
|
|
18
18
|
export declare function isErrorStatus(status: number): boolean;
|
|
19
19
|
export declare function isMediaTypeAllowed(mediaType: string): boolean;
|
|
20
|
-
export declare function getOperationName({ path, method, operation, options,
|
|
20
|
+
export declare function getOperationName({ path, method, operation, options, tag, keepOperationTag, keepOperationPrefix, }: {
|
|
21
21
|
path: string;
|
|
22
22
|
method: string;
|
|
23
23
|
operation: OperationObject;
|
|
24
24
|
options: GenerateOptions;
|
|
25
|
-
|
|
25
|
+
tag: string;
|
|
26
|
+
keepOperationTag?: boolean;
|
|
27
|
+
keepOperationPrefix?: boolean;
|
|
26
28
|
}): string;
|
|
27
|
-
export declare function getUniqueOperationName({
|
|
29
|
+
export declare function getUniqueOperationName({ operationsByTag, ...params }: {
|
|
28
30
|
path: string;
|
|
29
31
|
method: string;
|
|
30
32
|
operation: OperationObject;
|
|
@@ -10,3 +10,4 @@ export declare const getMostCommonAdjacentCombinationSplit: (strs: string[]) =>
|
|
|
10
10
|
export declare const splitByUppercase: (str: string) => string[];
|
|
11
11
|
export declare const camelToSpaceSeparated: (text: string) => string;
|
|
12
12
|
export declare const getAdjacentStringCombinations: (strs: string[], ignoreStrs?: string[]) => string[];
|
|
13
|
+
export declare const removeWord: (source: string, wordToRemove: string) => string;
|