@povio/openapi-codegen-cli 0.1.2 → 0.2.1
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/const/endpoints.const.d.ts +1 -3
- package/dist/generators/const/template.const.d.ts +10 -0
- package/dist/generators/types/generate.d.ts +7 -2
- package/dist/generators/types/metadata.d.ts +8 -8
- package/dist/generators/utils/generate/generate.endpoints.utils.d.ts +2 -5
- package/dist/generators/utils/generate/generate.imports.utils.d.ts +1 -0
- package/dist/generators/utils/openapi.utils.d.ts +1 -2
- package/dist/generators/utils/ts.utils.d.ts +5 -0
- package/dist/index.js +36 -36
- package/dist/sh.js +57 -57
- package/package.json +2 -2
- package/src/generators/templates/partials/query-use-mutation.hbs +3 -2
- package/src/generators/templates/partials/query-use-query.hbs +3 -2
- package/src/generators/templates/queries.hbs +2 -0
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Import } from "../types/generate";
|
|
2
1
|
export declare const DEFAULT_HEADERS: {
|
|
3
2
|
"Content-Type": string;
|
|
4
3
|
Accept: string;
|
|
5
4
|
};
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const REST_CLIENT_IMPORT: Import;
|
|
5
|
+
export declare const BODY_PARAMETER_NAME = "data";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Import } from "../types/generate";
|
|
2
|
+
export declare const DATA_FILE_PATH = "src/data";
|
|
3
|
+
export declare const DATA_TS_PATH = "@/data";
|
|
4
|
+
export declare const REST_CLIENT_NAME = "AppRestClient";
|
|
5
|
+
export declare const REST_CLIENT_IMPORT: Import;
|
|
6
|
+
export declare const QUERY_OPTIONS_TYPES: {
|
|
7
|
+
query: string;
|
|
8
|
+
mutation: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const QUERY_TYPES_IMPORT: Import;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { Endpoint } from "./endpoint";
|
|
2
|
-
export
|
|
2
|
+
export interface Import {
|
|
3
3
|
bindings: string[];
|
|
4
4
|
from: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
export declare enum GenerateType {
|
|
7
7
|
Models = "models",
|
|
8
8
|
Endpoints = "endpoints",
|
|
9
9
|
Queries = "queries"
|
|
10
10
|
}
|
|
11
|
+
export interface TsFieldDescriptor {
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
required: boolean;
|
|
15
|
+
}
|
|
11
16
|
export type GenerateData = Map<string, {
|
|
12
17
|
endpoints: Endpoint[];
|
|
13
18
|
zodSchemas: Record<string, string>;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
+
import { TsFieldDescriptor } from "./generate";
|
|
2
3
|
import { GenerateOptions } from "./options";
|
|
3
4
|
export interface GenerateMetadataParams {
|
|
4
5
|
input: string;
|
|
5
6
|
options?: Partial<GenerateOptions>;
|
|
6
7
|
}
|
|
7
|
-
export interface
|
|
8
|
-
name: string;
|
|
9
|
-
zodSchemaName: string;
|
|
10
|
-
filePath: string;
|
|
11
|
-
namespace?: string;
|
|
12
|
-
openApiSchema?: OpenAPIV3.SchemaObject;
|
|
13
|
-
}
|
|
14
|
-
export interface QueryMetadata {
|
|
8
|
+
export interface BaseMetadata {
|
|
15
9
|
name: string;
|
|
16
10
|
filePath: string;
|
|
17
11
|
namespace?: string;
|
|
18
12
|
}
|
|
13
|
+
export type ModelMetadata = BaseMetadata & {
|
|
14
|
+
properties: TsFieldDescriptor[];
|
|
15
|
+
};
|
|
16
|
+
export type QueryMetadata = BaseMetadata & {
|
|
17
|
+
params: TsFieldDescriptor[];
|
|
18
|
+
};
|
|
19
19
|
export interface GenerateMetadata {
|
|
20
20
|
openApiDoc: OpenAPIV3.Document;
|
|
21
21
|
models: ModelMetadata[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
2
|
import { SchemaResolver } from "src/generators/core/SchemaResolver.class";
|
|
3
|
+
import { TsFieldDescriptor } from "src/generators/types/generate";
|
|
3
4
|
import { GenerateOptions } from "src/generators/types/options";
|
|
4
5
|
import { Endpoint } from "../../types/endpoint";
|
|
5
6
|
export declare const getEndpointName: (endpoint: Endpoint) => string;
|
|
@@ -10,11 +11,7 @@ export declare function mapEndpointParamsToFunctionParams({ resolver, endpoint,
|
|
|
10
11
|
resolver: SchemaResolver;
|
|
11
12
|
endpoint: Endpoint;
|
|
12
13
|
options: GenerateOptions;
|
|
13
|
-
}):
|
|
14
|
-
name: string;
|
|
15
|
-
type: string;
|
|
16
|
-
required: boolean;
|
|
17
|
-
}[];
|
|
14
|
+
}): TsFieldDescriptor[];
|
|
18
15
|
export declare function getEndpointConfig(endpoint: Endpoint): {
|
|
19
16
|
headers?: {
|
|
20
17
|
Accept?: string | undefined;
|
|
@@ -10,8 +10,7 @@ export declare function normalizeString(text: string): string;
|
|
|
10
10
|
export declare function wrapWithQuotesIfNeeded(str: string): string;
|
|
11
11
|
export declare function unwrapQuotesIfNeeded(value: string | number): string | number;
|
|
12
12
|
export declare function pathParamToVariableName(name: string): string;
|
|
13
|
-
export declare const isPrimitiveType: (type: SingleType) => type is PrimitiveType;
|
|
14
|
-
export declare function primitiveTypeToTsType(type: PrimitiveType): string;
|
|
13
|
+
export declare const isPrimitiveType: (type: SingleType | undefined) => type is PrimitiveType;
|
|
15
14
|
export declare function escapeControlCharacters(str: string): string;
|
|
16
15
|
export declare const toBoolean: (value: undefined | string | boolean, defaultValue: boolean) => boolean;
|
|
17
16
|
export declare function isParamMediaTypeAllowed(mediaType: string): mediaType is (typeof ALLOWED_PARAM_MEDIA_TYPES)[number] | `application/${string}json${string}` | `text/${string}`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
+
import { TsFieldDescriptor } from "../types/generate";
|
|
3
|
+
import { PrimitiveType } from "../types/openapi";
|
|
4
|
+
export declare function primitiveTypeToTsType(type: PrimitiveType): string;
|
|
5
|
+
export declare function getSchemaTsProperties(schema: OpenAPIV3.SchemaObject): TsFieldDescriptor[];
|