@orpc/openapi 0.0.0-next.c0afbea → 0.0.0-next.c0dd7cd
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 +2 -0
- package/dist/adapters/fetch/index.d.mts +4 -2
- package/dist/adapters/fetch/index.d.ts +4 -2
- package/dist/adapters/fetch/index.mjs +2 -2
- package/dist/adapters/hono/index.d.mts +2 -0
- package/dist/adapters/hono/index.d.ts +2 -0
- package/dist/adapters/hono/index.mjs +2 -2
- package/dist/adapters/next/index.d.mts +2 -0
- package/dist/adapters/next/index.d.ts +2 -0
- package/dist/adapters/next/index.mjs +2 -2
- package/dist/adapters/node/index.d.mts +4 -2
- package/dist/adapters/node/index.d.ts +4 -2
- package/dist/adapters/node/index.mjs +7 -5
- package/dist/adapters/standard/index.d.mts +6 -5
- package/dist/adapters/standard/index.d.ts +6 -5
- package/dist/adapters/standard/index.mjs +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +3 -3
- package/dist/shared/{openapi.CJTe38Ya.mjs → openapi.BNHmrMe2.mjs} +3 -3
- package/dist/shared/{openapi.CbzTVvGL.mjs → openapi.Dv-KT_Bx.mjs} +7 -5
- package/dist/shared/openapi.IfmmOyba.d.mts +8 -0
- package/dist/shared/openapi.IfmmOyba.d.ts +8 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -60,6 +60,8 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
60
60
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
61
61
|
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
|
62
62
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
|
63
|
+
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
|
64
|
+
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
|
63
65
|
|
|
64
66
|
## `@orpc/openapi`
|
|
65
67
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { FetchHandler, FetchHandleResult } from '@orpc/server/fetch';
|
|
3
|
-
import {
|
|
3
|
+
import { StandardHandleOptions } from '@orpc/server/standard';
|
|
4
4
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
|
5
5
|
import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
|
|
6
|
+
import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.IfmmOyba.mjs';
|
|
7
|
+
import '@orpc/openapi-client/standard';
|
|
6
8
|
|
|
7
9
|
declare class OpenAPIHandler<T extends Context> implements FetchHandler<T> {
|
|
8
10
|
private readonly standardHandler;
|
|
9
|
-
constructor(router: Router<any, T>, options?: NoInfer<
|
|
11
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T>>);
|
|
10
12
|
handle(request: Request, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & ToFetchResponseOptions>): Promise<FetchHandleResult>;
|
|
11
13
|
}
|
|
12
14
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { FetchHandler, FetchHandleResult } from '@orpc/server/fetch';
|
|
3
|
-
import {
|
|
3
|
+
import { StandardHandleOptions } from '@orpc/server/standard';
|
|
4
4
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
|
5
5
|
import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
|
|
6
|
+
import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.IfmmOyba.js';
|
|
7
|
+
import '@orpc/openapi-client/standard';
|
|
6
8
|
|
|
7
9
|
declare class OpenAPIHandler<T extends Context> implements FetchHandler<T> {
|
|
8
10
|
private readonly standardHandler;
|
|
9
|
-
constructor(router: Router<any, T>, options?: NoInfer<
|
|
11
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T>>);
|
|
10
12
|
handle(request: Request, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & ToFetchResponseOptions>): Promise<FetchHandleResult>;
|
|
11
13
|
}
|
|
12
14
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { O as OpenAPIHandler } from '../../shared/openapi.
|
|
1
|
+
export { O as OpenAPIHandler } from '../../shared/openapi.Dv-KT_Bx.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.BNHmrMe2.mjs';
|
|
6
6
|
import '@orpc/contract';
|
|
7
7
|
import '@orpc/shared';
|
|
8
8
|
import '@orpc/server';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { O as OpenAPIHandler } from '../../shared/openapi.
|
|
1
|
+
export { O as OpenAPIHandler } from '../../shared/openapi.Dv-KT_Bx.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.BNHmrMe2.mjs';
|
|
6
6
|
import '@orpc/contract';
|
|
7
7
|
import '@orpc/shared';
|
|
8
8
|
import '@orpc/server';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { O as OpenAPIHandler } from '../../shared/openapi.
|
|
1
|
+
export { O as OpenAPIHandler } from '../../shared/openapi.Dv-KT_Bx.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.BNHmrMe2.mjs';
|
|
6
6
|
import '@orpc/contract';
|
|
7
7
|
import '@orpc/shared';
|
|
8
8
|
import '@orpc/server';
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { NodeHttpHandler, NodeHttpRequest, NodeHttpResponse, NodeHttpHandleResult } from '@orpc/server/node';
|
|
3
|
-
import {
|
|
3
|
+
import { StandardHandleOptions } from '@orpc/server/standard';
|
|
4
4
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
|
5
5
|
import { SendStandardResponseOptions } from '@orpc/standard-server-node';
|
|
6
|
+
import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.IfmmOyba.mjs';
|
|
7
|
+
import '@orpc/openapi-client/standard';
|
|
6
8
|
|
|
7
9
|
declare class OpenAPIHandler<T extends Context> implements NodeHttpHandler<T> {
|
|
8
10
|
private readonly standardHandler;
|
|
9
|
-
constructor(router: Router<any, T>, options?: NoInfer<
|
|
11
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T>>);
|
|
10
12
|
handle(req: NodeHttpRequest, res: NodeHttpResponse, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & SendStandardResponseOptions>): Promise<NodeHttpHandleResult>;
|
|
11
13
|
}
|
|
12
14
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { NodeHttpHandler, NodeHttpRequest, NodeHttpResponse, NodeHttpHandleResult } from '@orpc/server/node';
|
|
3
|
-
import {
|
|
3
|
+
import { StandardHandleOptions } from '@orpc/server/standard';
|
|
4
4
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
|
5
5
|
import { SendStandardResponseOptions } from '@orpc/standard-server-node';
|
|
6
|
+
import { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.IfmmOyba.js';
|
|
7
|
+
import '@orpc/openapi-client/standard';
|
|
6
8
|
|
|
7
9
|
declare class OpenAPIHandler<T extends Context> implements NodeHttpHandler<T> {
|
|
8
10
|
private readonly standardHandler;
|
|
9
|
-
constructor(router: Router<any, T>, options?: NoInfer<
|
|
11
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardOpenAPIHandlerOptions<T>>);
|
|
10
12
|
handle(req: NodeHttpRequest, res: NodeHttpResponse, ...[options,]: MaybeOptionalOptions<StandardHandleOptions<T> & SendStandardResponseOptions>): Promise<NodeHttpHandleResult>;
|
|
11
13
|
}
|
|
12
14
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StandardOpenAPIJsonSerializer, StandardBracketNotationSerializer, StandardOpenAPISerializer } 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
|
|
4
|
+
import { a as StandardOpenAPIMatcher, S as StandardOpenAPICodec } from '../../shared/openapi.BNHmrMe2.mjs';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
import 'json-schema-typed/draft-2020-12';
|
|
7
7
|
import '@orpc/contract';
|
|
@@ -12,9 +12,11 @@ import '../../shared/openapi.DZzpQAb-.mjs';
|
|
|
12
12
|
class OpenAPIHandler {
|
|
13
13
|
standardHandler;
|
|
14
14
|
constructor(router, options = {}) {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
15
|
+
const jsonSerializer = new StandardOpenAPIJsonSerializer(options);
|
|
16
|
+
const bracketNotationSerializer = new StandardBracketNotationSerializer();
|
|
17
|
+
const serializer = new StandardOpenAPISerializer(jsonSerializer, bracketNotationSerializer);
|
|
18
|
+
const matcher = new StandardOpenAPIMatcher();
|
|
19
|
+
const codec = new StandardOpenAPICodec(serializer);
|
|
18
20
|
this.standardHandler = new StandardHandler(router, matcher, codec, options);
|
|
19
21
|
}
|
|
20
22
|
async handle(req, res, ...[
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { ORPCError } from '@orpc/client';
|
|
2
|
-
import {
|
|
2
|
+
import { StandardOpenAPISerializer } from '@orpc/openapi-client/standard';
|
|
3
3
|
import { AnyProcedure, AnyRouter } from '@orpc/server';
|
|
4
4
|
import { StandardCodec, StandardParams, StandardMatcher, StandardMatchResult } from '@orpc/server/standard';
|
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
|
6
|
+
export { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.IfmmOyba.mjs';
|
|
6
7
|
import { HTTPPath } from '@orpc/contract';
|
|
7
8
|
|
|
8
|
-
declare class
|
|
9
|
+
declare class StandardOpenAPICodec implements StandardCodec {
|
|
9
10
|
private readonly serializer;
|
|
10
|
-
constructor(serializer:
|
|
11
|
+
constructor(serializer: StandardOpenAPISerializer);
|
|
11
12
|
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
12
13
|
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
13
14
|
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
declare class
|
|
17
|
+
declare class StandardOpenAPIMatcher implements StandardMatcher {
|
|
17
18
|
private readonly tree;
|
|
18
19
|
private pendingRouters;
|
|
19
20
|
init(router: AnyRouter, path?: readonly string[]): void;
|
|
@@ -31,4 +32,4 @@ declare function toRou3Pattern(path: HTTPPath): string;
|
|
|
31
32
|
*/
|
|
32
33
|
declare function decodeParams(params: Record<string, string>): Record<string, string>;
|
|
33
34
|
|
|
34
|
-
export {
|
|
35
|
+
export { StandardOpenAPICodec, StandardOpenAPIMatcher, decodeParams, toRou3Pattern };
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { ORPCError } from '@orpc/client';
|
|
2
|
-
import {
|
|
2
|
+
import { StandardOpenAPISerializer } from '@orpc/openapi-client/standard';
|
|
3
3
|
import { AnyProcedure, AnyRouter } from '@orpc/server';
|
|
4
4
|
import { StandardCodec, StandardParams, StandardMatcher, StandardMatchResult } from '@orpc/server/standard';
|
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
|
6
|
+
export { S as StandardOpenAPIHandlerOptions } from '../../shared/openapi.IfmmOyba.js';
|
|
6
7
|
import { HTTPPath } from '@orpc/contract';
|
|
7
8
|
|
|
8
|
-
declare class
|
|
9
|
+
declare class StandardOpenAPICodec implements StandardCodec {
|
|
9
10
|
private readonly serializer;
|
|
10
|
-
constructor(serializer:
|
|
11
|
+
constructor(serializer: StandardOpenAPISerializer);
|
|
11
12
|
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
12
13
|
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
13
14
|
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
declare class
|
|
17
|
+
declare class StandardOpenAPIMatcher implements StandardMatcher {
|
|
17
18
|
private readonly tree;
|
|
18
19
|
private pendingRouters;
|
|
19
20
|
init(router: AnyRouter, path?: readonly string[]): void;
|
|
@@ -31,4 +32,4 @@ declare function toRou3Pattern(path: HTTPPath): string;
|
|
|
31
32
|
*/
|
|
32
33
|
declare function decodeParams(params: Record<string, string>): Record<string, string>;
|
|
33
34
|
|
|
34
|
-
export {
|
|
35
|
+
export { StandardOpenAPICodec, StandardOpenAPIMatcher, decodeParams, toRou3Pattern };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { S as StandardOpenAPICodec, a as StandardOpenAPIMatcher, d as decodeParams, t as toRou3Pattern } from '../../shared/openapi.BNHmrMe2.mjs';
|
|
2
2
|
import '@orpc/contract';
|
|
3
3
|
import '@orpc/shared';
|
|
4
4
|
import '@orpc/server';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnyContractProcedure, AnySchema, AnyContractRouter, HTTPPath, HTTPMethod } from '@orpc/contract';
|
|
2
2
|
import { OpenAPIV3_1 } from 'openapi-types';
|
|
3
3
|
export { OpenAPIV3_1 as OpenAPI } from 'openapi-types';
|
|
4
|
+
import { StandardOpenAPIJsonSerializerOptions } from '@orpc/openapi-client/standard';
|
|
4
5
|
import { AnyRouter } from '@orpc/server';
|
|
5
6
|
import { JSONSchema } from 'json-schema-typed/draft-2020-12';
|
|
6
7
|
export { JSONSchema, Format as JSONSchemaFormat } from 'json-schema-typed/draft-2020-12';
|
|
@@ -43,7 +44,7 @@ declare class CompositeSchemaConverter implements SchemaConverter {
|
|
|
43
44
|
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
interface OpenAPIGeneratorOptions {
|
|
47
|
+
interface OpenAPIGeneratorOptions extends StandardOpenAPIJsonSerializerOptions {
|
|
47
48
|
schemaConverters?: ConditionalSchemaConverter[];
|
|
48
49
|
}
|
|
49
50
|
declare class OpenAPIGenerator {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnyContractProcedure, AnySchema, AnyContractRouter, HTTPPath, HTTPMethod } from '@orpc/contract';
|
|
2
2
|
import { OpenAPIV3_1 } from 'openapi-types';
|
|
3
3
|
export { OpenAPIV3_1 as OpenAPI } from 'openapi-types';
|
|
4
|
+
import { StandardOpenAPIJsonSerializerOptions } from '@orpc/openapi-client/standard';
|
|
4
5
|
import { AnyRouter } from '@orpc/server';
|
|
5
6
|
import { JSONSchema } from 'json-schema-typed/draft-2020-12';
|
|
6
7
|
export { JSONSchema, Format as JSONSchemaFormat } from 'json-schema-typed/draft-2020-12';
|
|
@@ -43,7 +44,7 @@ declare class CompositeSchemaConverter implements SchemaConverter {
|
|
|
43
44
|
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: JSONSchema];
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
interface OpenAPIGeneratorOptions {
|
|
47
|
+
interface OpenAPIGeneratorOptions extends StandardOpenAPIJsonSerializerOptions {
|
|
47
48
|
schemaConverters?: ConditionalSchemaConverter[];
|
|
48
49
|
}
|
|
49
50
|
declare class OpenAPIGenerator {
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isProcedure, resolveContractProcedures, toHttpPath } from '@orpc/server';
|
|
2
2
|
import { fallbackORPCErrorStatus, fallbackORPCErrorMessage } from '@orpc/client';
|
|
3
3
|
import { fallbackContractConfig, getEventIteratorSchemaDetails } from '@orpc/contract';
|
|
4
|
-
import {
|
|
4
|
+
import { StandardOpenAPIJsonSerializer } from '@orpc/openapi-client/standard';
|
|
5
5
|
import { clone } from '@orpc/shared';
|
|
6
6
|
import { t as toOpenAPIMethod, a as toOpenAPIPath, b as toOpenAPIEventIteratorContent, g as getDynamicParams, i as isAnySchema, c as isObjectSchema, d as separateObjectSchema, e as checkParamsSchema, f as toOpenAPIParameters, h as toOpenAPIContent, j as toOpenAPISchema } from './shared/openapi.DZzpQAb-.mjs';
|
|
7
7
|
export { L as LOGIC_KEYWORDS, l as filterSchemaBranches, k as isFileSchema, s as standardizeHTTPPath } from './shared/openapi.DZzpQAb-.mjs';
|
|
@@ -72,7 +72,7 @@ class OpenAPIGenerator {
|
|
|
72
72
|
serializer;
|
|
73
73
|
converter;
|
|
74
74
|
constructor(options = {}) {
|
|
75
|
-
this.serializer = new
|
|
75
|
+
this.serializer = new StandardOpenAPIJsonSerializer(options);
|
|
76
76
|
this.converter = new CompositeSchemaConverter(options.schemaConverters ?? []);
|
|
77
77
|
}
|
|
78
78
|
async generate(router, base) {
|
|
@@ -115,7 +115,7 @@ ${e.message}`
|
|
|
115
115
|
${errors.join("\n\n")}`
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
|
-
return this.serializer.serialize(doc);
|
|
118
|
+
return this.serializer.serialize(doc)[0];
|
|
119
119
|
}
|
|
120
120
|
#request(ref, def) {
|
|
121
121
|
const method = fallbackContractConfig("defaultMethod", def.route.method);
|
|
@@ -4,7 +4,7 @@ import { traverseContractProcedures, toHttpPath, isProcedure, getLazyMeta, unlaz
|
|
|
4
4
|
import { createRouter, addRoute, findRoute } from 'rou3';
|
|
5
5
|
import { s as standardizeHTTPPath } from './openapi.DZzpQAb-.mjs';
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class StandardOpenAPICodec {
|
|
8
8
|
constructor(serializer) {
|
|
9
9
|
this.serializer = serializer;
|
|
10
10
|
}
|
|
@@ -77,7 +77,7 @@ function decodeParams(params) {
|
|
|
77
77
|
return Object.fromEntries(Object.entries(params).map(([key, value]) => [key, decodeURIComponent(value)]));
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
class
|
|
80
|
+
class StandardOpenAPIMatcher {
|
|
81
81
|
tree = createRouter();
|
|
82
82
|
pendingRouters = [];
|
|
83
83
|
init(router, path = []) {
|
|
@@ -142,4 +142,4 @@ class OpenAPIMatcher {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
export {
|
|
145
|
+
export { StandardOpenAPICodec as S, StandardOpenAPIMatcher as a, decodeParams as d, toRou3Pattern as t };
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StandardOpenAPIJsonSerializer, StandardBracketNotationSerializer, StandardOpenAPISerializer } from '@orpc/openapi-client/standard';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
3
|
import { toStandardLazyRequest, toFetchResponse } from '@orpc/standard-server-fetch';
|
|
4
|
-
import { a as
|
|
4
|
+
import { a as StandardOpenAPIMatcher, S as StandardOpenAPICodec } from './openapi.BNHmrMe2.mjs';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
import 'json-schema-typed/draft-2020-12';
|
|
7
7
|
|
|
8
8
|
class OpenAPIHandler {
|
|
9
9
|
standardHandler;
|
|
10
10
|
constructor(router, options = {}) {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
11
|
+
const jsonSerializer = new StandardOpenAPIJsonSerializer(options);
|
|
12
|
+
const bracketNotationSerializer = new StandardBracketNotationSerializer();
|
|
13
|
+
const serializer = new StandardOpenAPISerializer(jsonSerializer, bracketNotationSerializer);
|
|
14
|
+
const matcher = new StandardOpenAPIMatcher();
|
|
15
|
+
const codec = new StandardOpenAPICodec(serializer);
|
|
14
16
|
this.standardHandler = new StandardHandler(router, matcher, codec, options);
|
|
15
17
|
}
|
|
16
18
|
async handle(request, ...[
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StandardOpenAPIJsonSerializerOptions } from '@orpc/openapi-client/standard';
|
|
2
|
+
import { Context } from '@orpc/server';
|
|
3
|
+
import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
|
+
|
|
5
|
+
interface StandardOpenAPIHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, StandardOpenAPIJsonSerializerOptions {
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type { StandardOpenAPIHandlerOptions as S };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StandardOpenAPIJsonSerializerOptions } from '@orpc/openapi-client/standard';
|
|
2
|
+
import { Context } from '@orpc/server';
|
|
3
|
+
import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
|
+
|
|
5
|
+
interface StandardOpenAPIHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, StandardOpenAPIJsonSerializerOptions {
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type { StandardOpenAPIHandlerOptions as S };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.c0dd7cd",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"json-schema-typed": "^8.0.1",
|
|
53
53
|
"openapi-types": "^12.1.3",
|
|
54
54
|
"rou3": "^0.5.1",
|
|
55
|
-
"@orpc/client": "0.0.0-next.
|
|
56
|
-
"@orpc/
|
|
57
|
-
"@orpc/
|
|
58
|
-
"@orpc/
|
|
59
|
-
"@orpc/
|
|
60
|
-
"@orpc/
|
|
61
|
-
"@orpc/standard-server
|
|
62
|
-
"@orpc/standard-server-node": "0.0.0-next.
|
|
55
|
+
"@orpc/client": "0.0.0-next.c0dd7cd",
|
|
56
|
+
"@orpc/server": "0.0.0-next.c0dd7cd",
|
|
57
|
+
"@orpc/shared": "0.0.0-next.c0dd7cd",
|
|
58
|
+
"@orpc/openapi-client": "0.0.0-next.c0dd7cd",
|
|
59
|
+
"@orpc/contract": "0.0.0-next.c0dd7cd",
|
|
60
|
+
"@orpc/standard-server-fetch": "0.0.0-next.c0dd7cd",
|
|
61
|
+
"@orpc/standard-server": "0.0.0-next.c0dd7cd",
|
|
62
|
+
"@orpc/standard-server-node": "0.0.0-next.c0dd7cd"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"zod": "^3.24.2"
|