typed-openapi 1.4.5 → 1.5.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/chunk-KAEXXJ7X.js +21 -0
- package/dist/{chunk-F4UA5MLD.js → chunk-O7DZWQK4.js} +17 -9
- package/dist/{chunk-52X6V4N5.js → chunk-OVT6OLBK.js} +141 -35
- package/dist/cli.js +4 -7
- package/dist/index.d.ts +6 -227
- package/dist/index.js +2 -1
- package/dist/node.export.d.ts +8 -5
- package/dist/node.export.js +4 -6
- package/dist/pretty.export.d.ts +5 -0
- package/dist/pretty.export.js +6 -0
- package/dist/types-DLE5RaXi.d.ts +242 -0
- package/package.json +3 -2
- package/src/cli.ts +1 -5
- package/src/generate-client-files.ts +20 -9
- package/src/generator.ts +28 -0
- package/src/map-openapi-endpoints.ts +30 -6
- package/src/node.export.ts +0 -1
- package/src/openapi-schema-to-ts.ts +15 -13
- package/src/pretty.export.ts +1 -0
- package/src/ref-resolver.ts +12 -2
- package/src/sanitize-name.ts +79 -0
- package/src/types.ts +14 -1
package/src/types.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { ReferenceObject, SchemaObject } from "openapi3-ts/oas31";
|
|
1
|
+
import type { OperationObject, ReferenceObject, SchemaObject } from "openapi3-ts/oas31";
|
|
2
2
|
import type { SchemaObject as SchemaObject3 } from "openapi3-ts/oas30";
|
|
3
3
|
|
|
4
4
|
import type { RefResolver } from "./ref-resolver.ts";
|
|
5
5
|
import { Box } from "./box.ts";
|
|
6
|
+
import type { Method } from "./map-openapi-endpoints.ts";
|
|
6
7
|
|
|
7
8
|
export type LibSchemaObject = SchemaObject & SchemaObject3;
|
|
8
9
|
|
|
@@ -94,10 +95,22 @@ export type FactoryCreator = (
|
|
|
94
95
|
schema: SchemaObject | ReferenceObject,
|
|
95
96
|
ctx: OpenapiSchemaConvertContext,
|
|
96
97
|
) => GenericFactory;
|
|
98
|
+
|
|
99
|
+
export type NameTransformOptions = {
|
|
100
|
+
transformSchemaName?: (name: string) => string;
|
|
101
|
+
transformEndpointName?: (endpoint: {
|
|
102
|
+
alias: string;
|
|
103
|
+
operation: OperationObject;
|
|
104
|
+
method: Method;
|
|
105
|
+
path: string;
|
|
106
|
+
}) => string;
|
|
107
|
+
};
|
|
108
|
+
|
|
97
109
|
export type OpenapiSchemaConvertContext = {
|
|
98
110
|
factory: FactoryCreator | GenericFactory;
|
|
99
111
|
refs: RefResolver;
|
|
100
112
|
onBox?: (box: Box<AnyBoxDef>) => Box<AnyBoxDef>;
|
|
113
|
+
nameTransform?: NameTransformOptions;
|
|
101
114
|
};
|
|
102
115
|
|
|
103
116
|
export type StringOrBox = string | Box<AnyBoxDef>;
|