@povio/openapi-codegen-cli 0.2.0 → 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/types/generate.d.ts +3 -3
- package/dist/generators/types/metadata.d.ts +8 -10
- package/dist/generators/utils/generate/generate.endpoints.utils.d.ts +2 -6
- package/dist/generators/utils/openapi.utils.d.ts +1 -2
- package/dist/generators/utils/ts.utils.d.ts +5 -0
- package/dist/index.js +34 -34
- package/dist/sh.js +48 -48
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
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
|
|
11
|
+
export interface TsFieldDescriptor {
|
|
12
12
|
name: string;
|
|
13
13
|
type: string;
|
|
14
14
|
required: boolean;
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
import {
|
|
2
|
+
import { TsFieldDescriptor } from "./generate";
|
|
3
3
|
import { GenerateOptions } from "./options";
|
|
4
4
|
export interface GenerateMetadataParams {
|
|
5
5
|
input: string;
|
|
6
6
|
options?: Partial<GenerateOptions>;
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface BaseMetadata {
|
|
9
9
|
name: string;
|
|
10
|
-
zodSchemaName: string;
|
|
11
10
|
filePath: string;
|
|
12
11
|
namespace?: string;
|
|
13
|
-
openApiSchema?: OpenAPIV3.SchemaObject;
|
|
14
|
-
}
|
|
15
|
-
export interface QueryMetadata {
|
|
16
|
-
name: string;
|
|
17
|
-
filePath: string;
|
|
18
|
-
namespace?: string;
|
|
19
|
-
params: FunctionParam[];
|
|
20
12
|
}
|
|
13
|
+
export type ModelMetadata = BaseMetadata & {
|
|
14
|
+
properties: TsFieldDescriptor[];
|
|
15
|
+
};
|
|
16
|
+
export type QueryMetadata = BaseMetadata & {
|
|
17
|
+
params: TsFieldDescriptor[];
|
|
18
|
+
};
|
|
21
19
|
export interface GenerateMetadata {
|
|
22
20
|
openApiDoc: OpenAPIV3.Document;
|
|
23
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,12 +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
|
-
paramType: "Query" | "Body" | "Header" | "Path";
|
|
17
|
-
required: boolean;
|
|
18
|
-
}[];
|
|
14
|
+
}): TsFieldDescriptor[];
|
|
19
15
|
export declare function getEndpointConfig(endpoint: Endpoint): {
|
|
20
16
|
headers?: {
|
|
21
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[];
|