@orpc/openapi 0.0.0-next.1431467 → 0.0.0-next.15d9202
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/README.md +3 -1
- package/dist/adapters/fetch/index.d.mts +1 -1
- package/dist/adapters/fetch/index.d.ts +1 -1
- package/dist/adapters/fetch/index.mjs +4 -3
- package/dist/adapters/hono/index.mjs +4 -3
- package/dist/adapters/next/index.mjs +4 -3
- package/dist/adapters/node/index.d.mts +1 -1
- package/dist/adapters/node/index.d.ts +1 -1
- package/dist/adapters/node/index.mjs +4 -3
- package/dist/adapters/standard/index.d.mts +13 -2
- package/dist/adapters/standard/index.d.ts +13 -2
- package/dist/adapters/standard/index.mjs +3 -2
- package/dist/index.d.mts +85 -133
- package/dist/index.d.ts +85 -133
- package/dist/index.mjs +226 -579
- package/dist/shared/{openapi.C_biOx82.mjs → openapi.CJTe38Ya.mjs} +18 -20
- package/dist/shared/{openapi.B6uueFtN.mjs → openapi.CbzTVvGL.mjs} +3 -1
- package/dist/shared/openapi.DZzpQAb-.mjs +231 -0
- package/package.json +10 -10
- package/dist/shared/openapi.BHG_gu5Z.mjs +0 -8
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
- **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
|
|
33
33
|
- **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
|
|
34
34
|
- **Multi-Runtime Support 🌍**: Run your code seamlessly on Cloudflare, Deno, Bun, Node.js, and more.
|
|
35
|
-
- **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue), Pinia Colada, and more.
|
|
35
|
+
- **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
|
|
36
36
|
- **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
|
|
37
37
|
- **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
|
|
38
38
|
- **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
|
|
@@ -55,6 +55,8 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
55
55
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
|
56
56
|
- [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
|
|
57
57
|
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
|
58
|
+
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
|
59
|
+
- [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
|
|
58
60
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
59
61
|
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
|
60
62
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
|
@@ -6,7 +6,7 @@ import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
|
|
|
6
6
|
|
|
7
7
|
declare class OpenAPIHandler<T extends Context> implements FetchHandler<T> {
|
|
8
8
|
private readonly standardHandler;
|
|
9
|
-
constructor(router: Router<
|
|
9
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardHandlerOptions<T>>);
|
|
10
10
|
handle(request: Request, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & ToFetchResponseOptions>): Promise<FetchHandleResult>;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
|
|
|
6
6
|
|
|
7
7
|
declare class OpenAPIHandler<T extends Context> implements FetchHandler<T> {
|
|
8
8
|
private readonly standardHandler;
|
|
9
|
-
constructor(router: Router<
|
|
9
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardHandlerOptions<T>>);
|
|
10
10
|
handle(request: Request, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & ToFetchResponseOptions>): Promise<FetchHandleResult>;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { O as OpenAPIHandler } from '../../shared/openapi.
|
|
1
|
+
export { O as OpenAPIHandler } from '../../shared/openapi.CbzTVvGL.mjs';
|
|
2
2
|
import '@orpc/openapi-client/standard';
|
|
3
3
|
import '@orpc/server/standard';
|
|
4
4
|
import '@orpc/standard-server-fetch';
|
|
5
|
-
import '../../shared/openapi.
|
|
5
|
+
import '../../shared/openapi.CJTe38Ya.mjs';
|
|
6
6
|
import '@orpc/contract';
|
|
7
7
|
import '@orpc/shared';
|
|
8
8
|
import '@orpc/server';
|
|
9
9
|
import 'rou3';
|
|
10
|
-
import '../../shared/openapi.
|
|
10
|
+
import '../../shared/openapi.DZzpQAb-.mjs';
|
|
11
|
+
import 'json-schema-typed/draft-2020-12';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { O as OpenAPIHandler } from '../../shared/openapi.
|
|
1
|
+
export { O as OpenAPIHandler } from '../../shared/openapi.CbzTVvGL.mjs';
|
|
2
2
|
import '@orpc/openapi-client/standard';
|
|
3
3
|
import '@orpc/server/standard';
|
|
4
4
|
import '@orpc/standard-server-fetch';
|
|
5
|
-
import '../../shared/openapi.
|
|
5
|
+
import '../../shared/openapi.CJTe38Ya.mjs';
|
|
6
6
|
import '@orpc/contract';
|
|
7
7
|
import '@orpc/shared';
|
|
8
8
|
import '@orpc/server';
|
|
9
9
|
import 'rou3';
|
|
10
|
-
import '../../shared/openapi.
|
|
10
|
+
import '../../shared/openapi.DZzpQAb-.mjs';
|
|
11
|
+
import 'json-schema-typed/draft-2020-12';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { O as OpenAPIHandler } from '../../shared/openapi.
|
|
1
|
+
export { O as OpenAPIHandler } from '../../shared/openapi.CbzTVvGL.mjs';
|
|
2
2
|
import '@orpc/openapi-client/standard';
|
|
3
3
|
import '@orpc/server/standard';
|
|
4
4
|
import '@orpc/standard-server-fetch';
|
|
5
|
-
import '../../shared/openapi.
|
|
5
|
+
import '../../shared/openapi.CJTe38Ya.mjs';
|
|
6
6
|
import '@orpc/contract';
|
|
7
7
|
import '@orpc/shared';
|
|
8
8
|
import '@orpc/server';
|
|
9
9
|
import 'rou3';
|
|
10
|
-
import '../../shared/openapi.
|
|
10
|
+
import '../../shared/openapi.DZzpQAb-.mjs';
|
|
11
|
+
import 'json-schema-typed/draft-2020-12';
|
|
@@ -6,7 +6,7 @@ import { SendStandardResponseOptions } from '@orpc/standard-server-node';
|
|
|
6
6
|
|
|
7
7
|
declare class OpenAPIHandler<T extends Context> implements NodeHttpHandler<T> {
|
|
8
8
|
private readonly standardHandler;
|
|
9
|
-
constructor(router: Router<
|
|
9
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardHandlerOptions<T>>);
|
|
10
10
|
handle(req: NodeHttpRequest, res: NodeHttpResponse, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & SendStandardResponseOptions>): Promise<NodeHttpHandleResult>;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ import { SendStandardResponseOptions } from '@orpc/standard-server-node';
|
|
|
6
6
|
|
|
7
7
|
declare class OpenAPIHandler<T extends Context> implements NodeHttpHandler<T> {
|
|
8
8
|
private readonly standardHandler;
|
|
9
|
-
constructor(router: Router<
|
|
9
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardHandlerOptions<T>>);
|
|
10
10
|
handle(req: NodeHttpRequest, res: NodeHttpResponse, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & SendStandardResponseOptions>): Promise<NodeHttpHandleResult>;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { OpenAPISerializer } from '@orpc/openapi-client/standard';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
3
|
import { toStandardLazyRequest, sendStandardResponse } from '@orpc/standard-server-node';
|
|
4
|
-
import { a as OpenAPIMatcher, O as OpenAPICodec } from '../../shared/openapi.
|
|
5
|
-
import '@orpc/contract';
|
|
4
|
+
import { a as OpenAPIMatcher, O as OpenAPICodec } from '../../shared/openapi.CJTe38Ya.mjs';
|
|
6
5
|
import '@orpc/shared';
|
|
6
|
+
import 'json-schema-typed/draft-2020-12';
|
|
7
|
+
import '@orpc/contract';
|
|
7
8
|
import '@orpc/server';
|
|
8
9
|
import 'rou3';
|
|
9
|
-
import '../../shared/openapi.
|
|
10
|
+
import '../../shared/openapi.DZzpQAb-.mjs';
|
|
10
11
|
|
|
11
12
|
class OpenAPIHandler {
|
|
12
13
|
standardHandler;
|
|
@@ -16,8 +16,19 @@ declare class OpenAPICodec implements StandardCodec {
|
|
|
16
16
|
declare class OpenAPIMatcher implements StandardMatcher {
|
|
17
17
|
private readonly tree;
|
|
18
18
|
private pendingRouters;
|
|
19
|
-
init(router: AnyRouter, path?: string[]): void;
|
|
19
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
20
20
|
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* {@link https://github.com/unjs/rou3}
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
declare function toRou3Pattern(path: HTTPPath): string;
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
declare function decodeParams(params: Record<string, string>): Record<string, string>;
|
|
33
|
+
|
|
34
|
+
export { OpenAPICodec, OpenAPIMatcher, decodeParams, toRou3Pattern };
|
|
@@ -16,8 +16,19 @@ declare class OpenAPICodec implements StandardCodec {
|
|
|
16
16
|
declare class OpenAPIMatcher implements StandardMatcher {
|
|
17
17
|
private readonly tree;
|
|
18
18
|
private pendingRouters;
|
|
19
|
-
init(router: AnyRouter, path?: string[]): void;
|
|
19
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
20
20
|
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* {@link https://github.com/unjs/rou3}
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
declare function toRou3Pattern(path: HTTPPath): string;
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
declare function decodeParams(params: Record<string, string>): Record<string, string>;
|
|
33
|
+
|
|
34
|
+
export { OpenAPICodec, OpenAPIMatcher, decodeParams, toRou3Pattern };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { O as OpenAPICodec, a as OpenAPIMatcher } from '../../shared/openapi.
|
|
1
|
+
export { O as OpenAPICodec, a as OpenAPIMatcher, d as decodeParams, t as toRou3Pattern } from '../../shared/openapi.CJTe38Ya.mjs';
|
|
2
2
|
import '@orpc/contract';
|
|
3
3
|
import '@orpc/shared';
|
|
4
4
|
import '@orpc/server';
|
|
5
5
|
import 'rou3';
|
|
6
|
-
import '../../shared/openapi.
|
|
6
|
+
import '../../shared/openapi.DZzpQAb-.mjs';
|
|
7
|
+
import 'json-schema-typed/draft-2020-12';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,167 +1,119 @@
|
|
|
1
|
-
import { AnyContractProcedure,
|
|
2
|
-
import
|
|
3
|
-
export { OpenAPI };
|
|
4
|
-
export { OpenApiBuilder } from 'openapi3-ts/oas31';
|
|
5
|
-
import { JSONSchema } from 'json-schema-typed/draft-2020-12';
|
|
6
|
-
export { JSONSchema, Format as JSONSchemaFormat, keywords as JSONSchemaKeywords } from 'json-schema-typed/draft-2020-12';
|
|
7
|
-
import { OpenAPIJsonSerializer } from '@orpc/openapi-client/standard';
|
|
1
|
+
import { AnyContractProcedure, AnySchema, AnyContractRouter, HTTPPath, HTTPMethod } from '@orpc/contract';
|
|
2
|
+
import { OpenAPIV3_1 } from 'openapi-types';
|
|
3
|
+
export { OpenAPIV3_1 as OpenAPI } from 'openapi-types';
|
|
8
4
|
import { AnyRouter } from '@orpc/server';
|
|
5
|
+
import { JSONSchema } from 'json-schema-typed/draft-2020-12';
|
|
6
|
+
export { JSONSchema, Format as JSONSchemaFormat } from 'json-schema-typed/draft-2020-12';
|
|
9
7
|
|
|
10
|
-
type OverrideOperationValue =
|
|
11
|
-
declare function
|
|
12
|
-
declare function
|
|
13
|
-
declare function
|
|
8
|
+
type OverrideOperationValue = Partial<OpenAPIV3_1.OperationObject> | ((current: OpenAPIV3_1.OperationObject, procedure: AnyContractProcedure) => OpenAPIV3_1.OperationObject);
|
|
9
|
+
declare function customOpenAPIOperation<T extends object>(o: T, extend: OverrideOperationValue): T;
|
|
10
|
+
declare function getCustomOpenAPIOperation(o: object): OverrideOperationValue | undefined;
|
|
11
|
+
declare function applyCustomOpenAPIOperation(operation: OpenAPIV3_1.OperationObject, contract: AnyContractProcedure): OpenAPIV3_1.OperationObject;
|
|
14
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
15
16
|
type ObjectSchema = JSONSchema & {
|
|
16
17
|
type: 'object';
|
|
17
18
|
} & object;
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
18
22
|
type FileSchema = JSONSchema & {
|
|
19
23
|
type: 'string';
|
|
20
24
|
contentMediaType: string;
|
|
21
25
|
} & object;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
isObjectSchema(schema: JSONSchema): schema is ObjectSchema;
|
|
27
|
-
isAnySchema(schema: JSONSchema): boolean;
|
|
28
|
-
isUndefinableSchema(schema: JSONSchema): boolean;
|
|
29
|
-
separateObjectSchema(schema: ObjectSchema, separatedProperties: string[]): [matched: ObjectSchema, rest: ObjectSchema];
|
|
30
|
-
filterSchemaBranches(schema: JSONSchema, check: (schema: JSONSchema) => boolean, matches?: JSONSchema[]): [matches: JSONSchema[], rest: JSONSchema | undefined];
|
|
31
|
-
}
|
|
32
|
-
type PublicSchemaUtils = Pick<SchemaUtils, keyof SchemaUtils>;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
declare const LOGIC_KEYWORDS: string[];
|
|
33
30
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
constructor(schemaUtils: PublicSchemaUtils);
|
|
37
|
-
build(jsonSchema: JSONSchema, options?: Partial<OpenAPI.MediaTypeObject>): OpenAPI.ContentObject;
|
|
31
|
+
interface SchemaConvertOptions {
|
|
32
|
+
strategy: 'input' | 'output';
|
|
38
33
|
}
|
|
39
|
-
type PublicOpenAPIContentBuilder = Pick<OpenAPIContentBuilder, keyof OpenAPIContentBuilder>;
|
|
40
|
-
|
|
41
|
-
declare class OpenAPIPathParser {
|
|
42
|
-
parseDynamicParams(path: string): {
|
|
43
|
-
name: string;
|
|
44
|
-
raw: string;
|
|
45
|
-
}[];
|
|
46
|
-
}
|
|
47
|
-
type PublicOpenAPIPathParser = Pick<OpenAPIPathParser, keyof OpenAPIPathParser>;
|
|
48
|
-
|
|
49
|
-
type SchemaConvertStrategy = 'input' | 'output';
|
|
50
34
|
interface SchemaConverter {
|
|
51
|
-
convert(schema:
|
|
35
|
+
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
|
|
52
36
|
}
|
|
53
37
|
interface ConditionalSchemaConverter extends SchemaConverter {
|
|
54
|
-
condition(schema:
|
|
38
|
+
condition(schema: AnySchema | undefined, options: SchemaConvertOptions): boolean;
|
|
55
39
|
}
|
|
56
40
|
declare class CompositeSchemaConverter implements SchemaConverter {
|
|
57
41
|
private readonly converters;
|
|
58
42
|
constructor(converters: ConditionalSchemaConverter[]);
|
|
59
|
-
convert(schema:
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
interface OpenAPIInputStructureParseResult {
|
|
63
|
-
paramsSchema: ObjectSchema | undefined;
|
|
64
|
-
querySchema: ObjectSchema | undefined;
|
|
65
|
-
headersSchema: ObjectSchema | undefined;
|
|
66
|
-
bodySchema: JSONSchema | undefined;
|
|
67
|
-
}
|
|
68
|
-
declare class OpenAPIInputStructureParser {
|
|
69
|
-
private readonly schemaConverter;
|
|
70
|
-
private readonly schemaUtils;
|
|
71
|
-
private readonly pathParser;
|
|
72
|
-
constructor(schemaConverter: SchemaConverter, schemaUtils: PublicSchemaUtils, pathParser: PublicOpenAPIPathParser);
|
|
73
|
-
parse(contract: AnyContractProcedure, structure: 'compact' | 'detailed'): OpenAPIInputStructureParseResult;
|
|
74
|
-
private parseDetailedSchema;
|
|
75
|
-
private parseCompactSchema;
|
|
76
|
-
}
|
|
77
|
-
type PublicOpenAPIInputStructureParser = Pick<OpenAPIInputStructureParser, keyof OpenAPIInputStructureParser>;
|
|
78
|
-
|
|
79
|
-
interface OpenAPIOutputStructureParseResult {
|
|
80
|
-
headersSchema: ObjectSchema | undefined;
|
|
81
|
-
bodySchema: JSONSchema | undefined;
|
|
82
|
-
}
|
|
83
|
-
declare class OpenAPIOutputStructureParser {
|
|
84
|
-
private readonly schemaConverter;
|
|
85
|
-
private readonly schemaUtils;
|
|
86
|
-
constructor(schemaConverter: SchemaConverter, schemaUtils: PublicSchemaUtils);
|
|
87
|
-
parse(contract: AnyContractProcedure, structure: 'compact' | 'detailed'): OpenAPIOutputStructureParseResult;
|
|
88
|
-
private parseDetailedSchema;
|
|
89
|
-
private parseCompactSchema;
|
|
90
|
-
}
|
|
91
|
-
type PublicOpenAPIOutputStructureParser = Pick<OpenAPIOutputStructureParser, keyof OpenAPIOutputStructureParser>;
|
|
92
|
-
|
|
93
|
-
declare class OpenAPIParametersBuilder {
|
|
94
|
-
build(paramIn: OpenAPI.ParameterObject['in'], jsonSchema: JSONSchema & {
|
|
95
|
-
type: 'object';
|
|
96
|
-
} & object, options?: Pick<OpenAPI.ParameterObject, 'example' | 'style' | 'required'>): OpenAPI.ParameterObject[];
|
|
97
|
-
buildHeadersObject(jsonSchema: JSONSchema & {
|
|
98
|
-
type: 'object';
|
|
99
|
-
} & object, options?: Pick<OpenAPI.ParameterObject, 'example' | 'style' | 'required'>): OpenAPI.HeadersObject;
|
|
43
|
+
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
|
|
100
44
|
}
|
|
101
|
-
type PublicOpenAPIParametersBuilder = Pick<OpenAPIParametersBuilder, keyof OpenAPIParametersBuilder>;
|
|
102
45
|
|
|
103
|
-
type ErrorHandlerStrategy = 'throw' | 'log' | 'ignore';
|
|
104
46
|
interface OpenAPIGeneratorOptions {
|
|
105
|
-
contentBuilder?: PublicOpenAPIContentBuilder;
|
|
106
|
-
parametersBuilder?: PublicOpenAPIParametersBuilder;
|
|
107
47
|
schemaConverters?: ConditionalSchemaConverter[];
|
|
108
|
-
schemaUtils?: PublicSchemaUtils;
|
|
109
|
-
jsonSerializer?: OpenAPIJsonSerializer;
|
|
110
|
-
pathParser?: PublicOpenAPIPathParser;
|
|
111
|
-
inputStructureParser?: PublicOpenAPIInputStructureParser;
|
|
112
|
-
outputStructureParser?: PublicOpenAPIOutputStructureParser;
|
|
113
|
-
/**
|
|
114
|
-
* Throw error when you missing define tag definition on OpenAPI root tags
|
|
115
|
-
*
|
|
116
|
-
* Example: if procedure has tags ['foo', 'bar'], and OpenAPI root tags is ['foo'], then error will be thrown
|
|
117
|
-
* Because OpenAPI root tags is missing 'bar' tag
|
|
118
|
-
*
|
|
119
|
-
* @default false
|
|
120
|
-
*/
|
|
121
|
-
considerMissingTagDefinitionAsError?: boolean;
|
|
122
|
-
/**
|
|
123
|
-
* Weather ignore procedures that has no path defined.
|
|
124
|
-
*
|
|
125
|
-
* @default false
|
|
126
|
-
*/
|
|
127
|
-
ignoreUndefinedPathProcedures?: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* What to do when we found an error with our router
|
|
130
|
-
*
|
|
131
|
-
* @default 'throw'
|
|
132
|
-
*/
|
|
133
|
-
errorHandlerStrategy?: ErrorHandlerStrategy;
|
|
134
|
-
/**
|
|
135
|
-
* Strict error response
|
|
136
|
-
*
|
|
137
|
-
* @default true
|
|
138
|
-
*/
|
|
139
|
-
strictErrorResponses?: boolean;
|
|
140
48
|
}
|
|
141
49
|
declare class OpenAPIGenerator {
|
|
142
|
-
private
|
|
143
|
-
private readonly
|
|
144
|
-
private readonly
|
|
145
|
-
private readonly schemaUtils;
|
|
146
|
-
private readonly jsonSerializer;
|
|
147
|
-
private readonly pathParser;
|
|
148
|
-
private readonly inputStructureParser;
|
|
149
|
-
private readonly outputStructureParser;
|
|
150
|
-
private readonly errorHandlerStrategy;
|
|
151
|
-
private readonly ignoreUndefinedPathProcedures;
|
|
152
|
-
private readonly considerMissingTagDefinitionAsError;
|
|
153
|
-
private readonly strictErrorResponses;
|
|
50
|
+
#private;
|
|
51
|
+
private readonly serializer;
|
|
52
|
+
private readonly converter;
|
|
154
53
|
constructor(options?: OpenAPIGeneratorOptions);
|
|
155
|
-
generate(router:
|
|
54
|
+
generate(router: AnyContractRouter | AnyRouter, base: Omit<OpenAPIV3_1.Document, 'openapi'>): Promise<OpenAPIV3_1.Document>;
|
|
156
55
|
}
|
|
157
56
|
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
158
60
|
declare function standardizeHTTPPath(path: HTTPPath): HTTPPath;
|
|
159
|
-
|
|
61
|
+
/**
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
declare function toOpenAPIPath(path: HTTPPath): string;
|
|
65
|
+
/**
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
declare function toOpenAPIMethod(method: HTTPMethod): Lowercase<HTTPMethod>;
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
declare function getDynamicParams(path: HTTPPath | undefined): string[] | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
declare function toOpenAPIContent(schema: JSONSchema): Record<string, OpenAPIV3_1.MediaTypeObject>;
|
|
77
|
+
/**
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
declare function toOpenAPIEventIteratorContent([yieldsRequired, yieldsSchema]: [boolean, JSONSchema], [returnsRequired, returnsSchema]: [boolean, JSONSchema]): Record<string, OpenAPIV3_1.MediaTypeObject>;
|
|
81
|
+
/**
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
declare function toOpenAPIParameters(schema: ObjectSchema, parameterIn: 'path' | 'query' | 'header' | 'cookie'): OpenAPIV3_1.ParameterObject[];
|
|
85
|
+
/**
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
declare function checkParamsSchema(schema: ObjectSchema, params: string[]): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
declare function toOpenAPISchema(schema: JSONSchema): OpenAPIV3_1.SchemaObject & object;
|
|
160
93
|
|
|
161
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
*@internal
|
|
96
|
+
*/
|
|
97
|
+
declare function isFileSchema(schema: JSONSchema): schema is FileSchema;
|
|
98
|
+
/**
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
declare function isObjectSchema(schema: JSONSchema): schema is ObjectSchema;
|
|
102
|
+
/**
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
declare function isAnySchema(schema: JSONSchema): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
declare function separateObjectSchema(schema: ObjectSchema, separatedProperties: string[]): [matched: ObjectSchema, rest: ObjectSchema];
|
|
110
|
+
/**
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
declare function filterSchemaBranches(schema: JSONSchema, check: (schema: JSONSchema) => boolean, matches?: JSONSchema[]): [matches: JSONSchema[], rest: JSONSchema | undefined];
|
|
162
114
|
|
|
163
115
|
declare const oo: {
|
|
164
|
-
spec: typeof
|
|
116
|
+
spec: typeof customOpenAPIOperation;
|
|
165
117
|
};
|
|
166
118
|
|
|
167
|
-
export { CompositeSchemaConverter, type ConditionalSchemaConverter, type FileSchema,
|
|
119
|
+
export { CompositeSchemaConverter, type ConditionalSchemaConverter, type FileSchema, LOGIC_KEYWORDS, type ObjectSchema, OpenAPIGenerator, type OpenAPIGeneratorOptions, type OverrideOperationValue, type SchemaConvertOptions, type SchemaConverter, applyCustomOpenAPIOperation, checkParamsSchema, customOpenAPIOperation, filterSchemaBranches, getCustomOpenAPIOperation, getDynamicParams, isAnySchema, isFileSchema, isObjectSchema, oo, separateObjectSchema, standardizeHTTPPath, toOpenAPIContent, toOpenAPIEventIteratorContent, toOpenAPIMethod, toOpenAPIParameters, toOpenAPIPath, toOpenAPISchema };
|