@orpc/openapi 2.0.0-beta.11 → 2.0.0-beta.15
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 -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 +3 -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 +2 -2
- package/dist/adapters/standard/index.d.mts +1 -1
- package/dist/adapters/standard/index.d.ts +1 -1
- package/dist/adapters/standard/index.mjs +3 -3
- package/dist/extensions/route.d.mts +1 -1
- package/dist/extensions/route.d.ts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +17 -17
- package/dist/shared/{openapi.B2SK0ZAr.mjs → openapi.BGFa20if.mjs} +2 -2
- package/dist/shared/{openapi.CTlpLuKN.mjs → openapi.BNWqBLvv.mjs} +1 -1
- package/dist/shared/{openapi.DmAa7YPO.mjs → openapi.Be9y-FmY.mjs} +3 -3
- package/dist/shared/{openapi.BcEtAxQj.d.mts → openapi.C8pX5sBa.d.mts} +2 -1
- package/dist/shared/{openapi.CX6Ri5dP.d.mts → openapi.CIjFg2mT.d.mts} +1 -0
- package/dist/shared/{openapi.7vgmPxca.d.ts → openapi.NGNu47sM.d.ts} +1 -0
- package/dist/shared/{openapi.BQzzr4-4.d.ts → openapi.zFD75jdI.d.ts} +2 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
50
50
|
- [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
|
|
51
51
|
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Implement your contract with [NestJS](https://nestjs.com/).
|
|
52
52
|
- [@orpc/bun](https://www.npmjs.com/package/@orpc/bun): Adapters for [Bun's Redis](https://bun.sh/).
|
|
53
|
+
- [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare): Adapters for [Cloudflare's RateLimit and Durable Objects](https://developers.cloudflare.com/workers/).
|
|
53
54
|
|
|
54
55
|
**Observability**
|
|
55
56
|
|
|
@@ -106,7 +107,6 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
106
107
|
</tr>
|
|
107
108
|
<tr>
|
|
108
109
|
<td align="center"><a href="https://github.com/christ12938?ref=orpc" target="_blank" rel="noopener" title="christ12938"><img src="https://avatars.githubusercontent.com/u/25758598?v=4" width="139" alt="christ12938"/><br />christ12938</a></td>
|
|
109
|
-
<td align="center"><a href="https://github.com/peter-adam-dy?ref=orpc" target="_blank" rel="noopener" title="Peter Adam"><img src="https://avatars.githubusercontent.com/u/132129459?u=4f3dbbb3b443990b56acb7d6a5d11ed2c555f6db&v=4" width="139" alt="Peter Adam"/><br />Peter Adam</a></td>
|
|
110
110
|
<td align="center"><a href="https://github.com/Ryanjso?ref=orpc" target="_blank" rel="noopener" title="Ryan Soderberg"><img src="https://avatars.githubusercontent.com/u/39172778?u=5ed913c31d57e7221b75784abcad48c7ebddde27&v=4" width="139" alt="Ryan Soderberg"/><br />Ryan Soderberg</a></td>
|
|
111
111
|
<td align="center"><a href="https://github.com/itigoore01?ref=orpc" target="_blank" rel="noopener" title="shota"><img src="https://avatars.githubusercontent.com/u/11831107?u=c976a6dc7e055eb026304c46c99100ed22b0c8e0&v=4" width="139" alt="shota"/><br />shota</a></td>
|
|
112
112
|
</tr>
|
|
@@ -167,6 +167,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
167
167
|
<a href="https://github.com/nguyenlc1993?ref=orpc" target="_blank" rel="noopener" title="Lê Cao Nguyên"><img src="https://avatars.githubusercontent.com/u/13871971?u=83c8b69d9e35b589c4e1f066cc113b1d9461386f&v=4" width="32" height="32" alt="Lê Cao Nguyên" /></a>
|
|
168
168
|
<a href="https://github.com/wobsoriano?ref=orpc" target="_blank" rel="noopener" title="Robert Soriano"><img src="https://avatars.githubusercontent.com/u/13049130?u=6d72104182e7c9ed25934815313fb69107332111&v=4" width="32" height="32" alt="Robert Soriano" /></a>
|
|
169
169
|
<a href="https://github.com/SKostyukovich?ref=orpc" target="_blank" rel="noopener" title="SKostyukovich"><img src="https://avatars.githubusercontent.com/u/10700067?v=4" width="32" height="32" alt="SKostyukovich" /></a>
|
|
170
|
+
<a href="https://github.com/peter-adam-dy?ref=orpc" target="_blank" rel="noopener" title="Peter Adam"><img src="https://avatars.githubusercontent.com/u/132129459?u=4f3dbbb3b443990b56acb7d6a5d11ed2c555f6db&v=4" width="32" height="32" alt="Peter Adam" /></a>
|
|
170
171
|
<a href="https://github.com/FabworksHQ?ref=orpc" target="_blank" rel="noopener" title="Fabworks"><img src="https://avatars.githubusercontent.com/u/160179500?v=4" width="32" height="32" alt="Fabworks" /></a>
|
|
171
172
|
<a href="https://github.com/NovakAnton?ref=orpc" target="_blank" rel="noopener" title="Novak Antonijevic"><img src="https://avatars.githubusercontent.com/u/157126729?u=ae49fa22292d55c0434ff0ca008206155b18663b&v=4" width="32" height="32" alt="Novak Antonijevic" /></a>
|
|
172
173
|
<a href="https://github.com/laduniestu?ref=orpc" target="_blank" rel="noopener" title="Laduni Estu Syalwa"><img src="https://avatars.githubusercontent.com/u/44757637?u=a2fc1ea8f7d827a96721176f79d30592d1c48059&v=4" width="32" height="32" alt="Laduni Estu Syalwa" /></a>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { FetchHandler, FetchHandlerOptions } from '@orpc/server/fetch';
|
|
3
3
|
import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
|
-
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.
|
|
4
|
+
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.CIjFg2mT.mjs';
|
|
5
5
|
import { ClientContext } from '@orpc/client';
|
|
6
6
|
import { FetchLinkTransportOptions } from '@orpc/client/fetch';
|
|
7
7
|
import { StandardLink, StandardLinkOptions } from '@orpc/client/standard';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { FetchHandler, FetchHandlerOptions } from '@orpc/server/fetch';
|
|
3
3
|
import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
|
-
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.
|
|
4
|
+
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.NGNu47sM.js';
|
|
5
5
|
import { ClientContext } from '@orpc/client';
|
|
6
6
|
import { FetchLinkTransportOptions } from '@orpc/client/fetch';
|
|
7
7
|
import { StandardLink, StandardLinkOptions } from '@orpc/client/standard';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { FetchHandler } from '@orpc/server/fetch';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.BNWqBLvv.mjs';
|
|
4
4
|
import { FetchLinkTransport } from '@orpc/client/fetch';
|
|
5
5
|
import { StandardLink } from '@orpc/client/standard';
|
|
6
|
-
import { O as OpenAPILinkCodec } from '../../shared/openapi.
|
|
6
|
+
import { O as OpenAPILinkCodec } from '../../shared/openapi.BGFa20if.mjs';
|
|
7
7
|
import '@orpc/client';
|
|
8
8
|
import '@orpc/server';
|
|
9
9
|
import '@orpc/shared';
|
|
10
10
|
import '@standardserver/core';
|
|
11
|
-
import '../../shared/openapi.
|
|
11
|
+
import '../../shared/openapi.Be9y-FmY.mjs';
|
|
12
12
|
import '../../shared/openapi.Bt87OzTt.mjs';
|
|
13
13
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
14
14
|
import 'rou3';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { NodeHttpHandler, NodeHttpHandlerOptions } from '@orpc/server/node';
|
|
3
3
|
import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
|
-
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.
|
|
4
|
+
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.CIjFg2mT.mjs';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standardserver/core';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Router } from '@orpc/server';
|
|
2
2
|
import { NodeHttpHandler, NodeHttpHandlerOptions } from '@orpc/server/node';
|
|
3
3
|
import { StandardHandlerOptions } from '@orpc/server/standard';
|
|
4
|
-
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.
|
|
4
|
+
import { O as OpenAPIHandlerCodecOptions } from '../../shared/openapi.NGNu47sM.js';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standardserver/core';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { NodeHttpHandler } from '@orpc/server/node';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.BNWqBLvv.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standardserver/core';
|
|
8
|
-
import '../../shared/openapi.
|
|
8
|
+
import '../../shared/openapi.Be9y-FmY.mjs';
|
|
9
9
|
import '../../shared/openapi.Bt87OzTt.mjs';
|
|
10
10
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
11
11
|
import 'rou3';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.
|
|
1
|
+
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.CIjFg2mT.mjs';
|
|
2
2
|
import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
3
3
|
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
4
4
|
import { RouterContract } from '@orpc/contract';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.
|
|
1
|
+
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.NGNu47sM.js';
|
|
2
2
|
import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
|
|
3
3
|
import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
|
|
4
4
|
import { RouterContract } from '@orpc/contract';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher } from '../../shared/openapi.
|
|
2
|
-
export { O as OpenAPILinkCodec, a as OpenAPILinkCodecError } from '../../shared/openapi.
|
|
1
|
+
export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher } from '../../shared/openapi.BNWqBLvv.mjs';
|
|
2
|
+
export { O as OpenAPILinkCodec, a as OpenAPILinkCodecError } from '../../shared/openapi.BGFa20if.mjs';
|
|
3
3
|
import '@orpc/client';
|
|
4
4
|
import '@orpc/server';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
import '@standardserver/core';
|
|
7
|
-
import '../../shared/openapi.
|
|
7
|
+
import '../../shared/openapi.Be9y-FmY.mjs';
|
|
8
8
|
import '../../shared/openapi.Bt87OzTt.mjs';
|
|
9
9
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
10
10
|
import 'rou3';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { ErrorMap, AnySchema } from '@orpc/contract';
|
|
3
3
|
import { Context } from '@orpc/server';
|
|
4
|
-
import { O as OpenAPIMeta } from '../shared/openapi.
|
|
4
|
+
import { O as OpenAPIMeta } from '../shared/openapi.C8pX5sBa.mjs';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
import '@standardserver/core';
|
|
7
7
|
import '../shared/openapi.CYgMBSUF.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { ErrorMap, AnySchema } from '@orpc/contract';
|
|
3
3
|
import { Context } from '@orpc/server';
|
|
4
|
-
import { O as OpenAPIMeta } from '../shared/openapi.
|
|
4
|
+
import { O as OpenAPIMeta } from '../shared/openapi.zFD75jdI.js';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
import '@standardserver/core';
|
|
7
7
|
import '../shared/openapi.CYgMBSUF.js';
|
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import { AnySchema, ErrorMap, ProcedureContract, InferSchemaInput, InferSchemaOu
|
|
|
6
6
|
import { PromiseWithError, Value } from '@orpc/shared';
|
|
7
7
|
import { J as JsonifiedValue, b as JsonifiedClientError, c as JsonifiedClient, a as OpenAPIDocument } from './shared/openapi.CYgMBSUF.mjs';
|
|
8
8
|
export { d as JsonifiedArray, O as OpenAPIOperationObject } from './shared/openapi.CYgMBSUF.mjs';
|
|
9
|
-
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.
|
|
9
|
+
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.C8pX5sBa.mjs';
|
|
10
10
|
import { JsonSchemaConverter, JsonSchema } from '@orpc/json-schema';
|
|
11
11
|
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
|
12
12
|
export { StandardBodyHint } from '@standardserver/core';
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { AnySchema, ErrorMap, ProcedureContract, InferSchemaInput, InferSchemaOu
|
|
|
6
6
|
import { PromiseWithError, Value } from '@orpc/shared';
|
|
7
7
|
import { J as JsonifiedValue, b as JsonifiedClientError, c as JsonifiedClient, a as OpenAPIDocument } from './shared/openapi.CYgMBSUF.js';
|
|
8
8
|
export { d as JsonifiedArray, O as OpenAPIOperationObject } from './shared/openapi.CYgMBSUF.js';
|
|
9
|
-
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.
|
|
9
|
+
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.zFD75jdI.js';
|
|
10
10
|
import { JsonSchemaConverter, JsonSchema } from '@orpc/json-schema';
|
|
11
11
|
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
|
12
12
|
export { StandardBodyHint } from '@standardserver/core';
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { B as BracketNotationSerializer } from './shared/openapi.Bt87OzTt.mjs';
|
|
2
|
-
import { createContractCaller,
|
|
3
|
-
import { O as OpenAPISerializer, D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, c as DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './shared/openapi.
|
|
4
|
-
export { d as OpenAPIJsonSerializer } from './shared/openapi.
|
|
2
|
+
import { createContractCaller, getAsyncIteratorObjectSchemaDetails, ProcedureContract, resolveMetaPlugins } from '@orpc/contract';
|
|
3
|
+
import { O as OpenAPISerializer, D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, c as DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './shared/openapi.Be9y-FmY.mjs';
|
|
4
|
+
export { d as OpenAPIJsonSerializer } from './shared/openapi.Be9y-FmY.mjs';
|
|
5
5
|
import { g as getOpenAPIMeta, o as openapi } from './shared/openapi.B9PQzqBn.mjs';
|
|
6
6
|
import { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
7
7
|
export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
@@ -109,14 +109,14 @@ ${errors.join("\n\n")}`
|
|
|
109
109
|
const inputStructure = meta?.inputStructure ?? DEFAULT_OPENAPI_INPUT_STRUCTURE;
|
|
110
110
|
const inputSchemas = def.inputSchemas;
|
|
111
111
|
if (inputStructure === "compact") {
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
114
|
-
const [yieldSchemas, returnSchemas] =
|
|
112
|
+
const asyncIteratorObjectDetails = getAsyncIteratorObjectDetails(inputSchemas);
|
|
113
|
+
if (asyncIteratorObjectDetails) {
|
|
114
|
+
const [yieldSchemas, returnSchemas] = asyncIteratorObjectDetails;
|
|
115
115
|
const yieldResult = await this.convertSchemas(yieldSchemas, "input");
|
|
116
116
|
const returnResult = await this.convertSchemas(returnSchemas, "input");
|
|
117
117
|
ref.requestBody = {
|
|
118
118
|
required: true,
|
|
119
|
-
content:
|
|
119
|
+
content: toAsyncIteratorObjectContent(yieldResult, returnResult, doc, options)
|
|
120
120
|
};
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
@@ -238,15 +238,15 @@ ${errors.join("\n\n")}`
|
|
|
238
238
|
const description = meta?.successDescription ?? DEFAULT_OPENAPI_SUCCESS_DESCRIPTION;
|
|
239
239
|
const outputStructure = meta?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
|
|
240
240
|
if (outputStructure === "compact") {
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
const [yieldSchemas, returnSchemas] =
|
|
241
|
+
const iteratorDetails = getAsyncIteratorObjectDetails(outputSchemas);
|
|
242
|
+
if (iteratorDetails) {
|
|
243
|
+
const [yieldSchemas, returnSchemas] = iteratorDetails;
|
|
244
244
|
const yieldResult = await this.convertSchemas(yieldSchemas, "output");
|
|
245
245
|
const returnResult = await this.convertSchemas(returnSchemas, "output");
|
|
246
246
|
ref.responses ??= {};
|
|
247
247
|
ref.responses[status] = {
|
|
248
248
|
description,
|
|
249
|
-
content:
|
|
249
|
+
content: toAsyncIteratorObjectContent(yieldResult, returnResult, doc, options)
|
|
250
250
|
};
|
|
251
251
|
return;
|
|
252
252
|
}
|
|
@@ -266,14 +266,14 @@ ${errors.join("\n\n")}`
|
|
|
266
266
|
if (!objectSchemaEntries) {
|
|
267
267
|
throw new OpenAPIGeneratorError(
|
|
268
268
|
`Procedure at path "${path.join(".")}" has outputStructure "detailed" but its output schema is not an object.
|
|
269
|
-
Expected shape: { status
|
|
269
|
+
Expected shape: { status?: number (less than 400), headers?: Record<string, string | string[]>, body?: unknown }`
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
272
|
const statusSchema = objectSchemaEntries?.find(([name]) => name === "status")?.[1];
|
|
273
|
-
if (statusSchema !== void 0 && (typeof statusSchema !== "object" || !Number.isInteger(statusSchema.const) || statusSchema.const
|
|
273
|
+
if (statusSchema !== void 0 && (typeof statusSchema !== "object" || !Number.isInteger(statusSchema.const) || statusSchema.const >= 400)) {
|
|
274
274
|
throw new OpenAPIGeneratorError(
|
|
275
275
|
`Procedure at path "${path.join(".")}" has an invalid "status" field in its outputStructure "detailed" schema.
|
|
276
|
-
Expected: a const integer
|
|
276
|
+
Expected: a const integer less than 400
|
|
277
277
|
Received: ${stringifyJSON(statusSchema)}`
|
|
278
278
|
);
|
|
279
279
|
}
|
|
@@ -410,14 +410,14 @@ function strip$schemaField(schema) {
|
|
|
410
410
|
const { $schema, ...rest } = schema;
|
|
411
411
|
return rest;
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function getAsyncIteratorObjectDetails(schemas) {
|
|
414
414
|
if (!schemas || schemas.length === 0) {
|
|
415
415
|
return void 0;
|
|
416
416
|
}
|
|
417
417
|
const yieldSchemas = [];
|
|
418
418
|
const returnSchemas = [];
|
|
419
419
|
for (const s of schemas) {
|
|
420
|
-
const details =
|
|
420
|
+
const details = getAsyncIteratorObjectSchemaDetails(s);
|
|
421
421
|
if (!details) {
|
|
422
422
|
return void 0;
|
|
423
423
|
}
|
|
@@ -428,7 +428,7 @@ function getEventIteratorDetails(schemas) {
|
|
|
428
428
|
}
|
|
429
429
|
return yieldSchemas.length || returnSchemas.length ? [yieldSchemas, returnSchemas] : void 0;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function toAsyncIteratorObjectContent([yieldSchema, yieldOptional], [returnSchema, returnOptional], doc, options) {
|
|
432
432
|
const schema = combineJsonSchemasWithComposition("oneOf", [
|
|
433
433
|
combineJsonObjectSchemaEntries([
|
|
434
434
|
["event", { const: "message" }, false],
|
|
@@ -4,7 +4,7 @@ import { unlazy } from '@orpc/server';
|
|
|
4
4
|
import { value, pathToHttpPath, mergeHttpPath, isTypescriptObject, stringifyJSON } from '@orpc/shared';
|
|
5
5
|
import { mergeStandardHeaders, parseStandardUrl, isStandardHeaders } from '@standardserver/core';
|
|
6
6
|
import { toStandardHeaders } from '@standardserver/fetch';
|
|
7
|
-
import { O as OpenAPISerializer, D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, g as getDynamicPathParams, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.
|
|
7
|
+
import { O as OpenAPISerializer, D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, g as getDynamicPathParams, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.Be9y-FmY.mjs';
|
|
8
8
|
import { g as getOpenAPIMeta } from './openapi.B9PQzqBn.mjs';
|
|
9
9
|
|
|
10
10
|
class OpenAPILinkCodecError extends TypeError {
|
|
@@ -243,7 +243,7 @@ class OpenAPILinkCodec {
|
|
|
243
243
|
return query || void 0;
|
|
244
244
|
}
|
|
245
245
|
async decodeResponse(response, path, _options) {
|
|
246
|
-
const isOk = response.status
|
|
246
|
+
const isOk = response.status < 400;
|
|
247
247
|
const procedure = await this.resolveProcedure(path);
|
|
248
248
|
const meta = getOpenAPIMeta(procedure);
|
|
249
249
|
const deserialized = await (async () => {
|
|
@@ -2,7 +2,7 @@ import { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
|
2
2
|
import { walkProcedureContractsSync, Procedure, unlazy, getRouter, createContractProcedure, DEFAULT_SUCCESS_STATUS, DEFAULT_ERROR_STATUS } from '@orpc/server';
|
|
3
3
|
import { value, pathToHttpPath, mergeHttpPath, normalizeHttpPath, tryDecodeURIComponent, isPlainObject, stringifyJSON, parseEmptyableJSON, isTypescriptObject, NullProtoObj } from '@orpc/shared';
|
|
4
4
|
import { parseStandardUrl, isStandardHeaders } from '@standardserver/core';
|
|
5
|
-
import { D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, O as OpenAPISerializer, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.
|
|
5
|
+
import { D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, O as OpenAPISerializer, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.Be9y-FmY.mjs';
|
|
6
6
|
import { g as getOpenAPIMeta } from './openapi.B9PQzqBn.mjs';
|
|
7
7
|
import { createRouter, addRoute, findRoute, routeToRegExp } from 'rou3';
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { wrapAsyncIteratorPreservingEventMeta, toORPCError, isORPCErrorJson, createORPCErrorFromJson } from '@orpc/client';
|
|
2
2
|
import { isPlainObject, isAsyncIteratorObject } from '@orpc/shared';
|
|
3
3
|
import { ErrorEvent } from '@standardserver/core';
|
|
4
4
|
import { B as BracketNotationSerializer } from './openapi.Bt87OzTt.mjs';
|
|
@@ -173,7 +173,7 @@ class OpenAPISerializer {
|
|
|
173
173
|
return data;
|
|
174
174
|
}
|
|
175
175
|
if (isAsyncIteratorObject(data)) {
|
|
176
|
-
return
|
|
176
|
+
return wrapAsyncIteratorPreservingEventMeta(data, {
|
|
177
177
|
mapResult: (result) => {
|
|
178
178
|
if (result.value === void 0) {
|
|
179
179
|
return result;
|
|
@@ -211,7 +211,7 @@ class OpenAPISerializer {
|
|
|
211
211
|
return data;
|
|
212
212
|
}
|
|
213
213
|
if (isAsyncIteratorObject(data)) {
|
|
214
|
-
return
|
|
214
|
+
return wrapAsyncIteratorPreservingEventMeta(data, {
|
|
215
215
|
mapResult: (result) => {
|
|
216
216
|
if (result.value === void 0) {
|
|
217
217
|
return result;
|
|
@@ -43,7 +43,8 @@ interface OpenAPIMeta {
|
|
|
43
43
|
*/
|
|
44
44
|
tags?: string[] | undefined;
|
|
45
45
|
/**
|
|
46
|
-
* HTTP status code returned on success.
|
|
46
|
+
* HTTP status code returned on success.
|
|
47
|
+
* Should be in the `2xx` range and must be less than `400`.
|
|
47
48
|
*
|
|
48
49
|
* @default 200
|
|
49
50
|
*/
|
|
@@ -38,6 +38,7 @@ interface OpenAPIHandlerCodecCoreOptions<_T extends Context> {
|
|
|
38
38
|
serializer?: Pick<OpenAPISerializer, keyof OpenAPISerializer>;
|
|
39
39
|
/**
|
|
40
40
|
* Mapping ORPCError Code -> HTTP Status Code
|
|
41
|
+
* The status code should be in the `4xx` or `5xx` range (must be greater than or equal to `400`).
|
|
41
42
|
*
|
|
42
43
|
* @default COMMON_ERROR_STATUS_MAP, DEFAULT_ERROR_STATUS
|
|
43
44
|
*/
|
|
@@ -38,6 +38,7 @@ interface OpenAPIHandlerCodecCoreOptions<_T extends Context> {
|
|
|
38
38
|
serializer?: Pick<OpenAPISerializer, keyof OpenAPISerializer>;
|
|
39
39
|
/**
|
|
40
40
|
* Mapping ORPCError Code -> HTTP Status Code
|
|
41
|
+
* The status code should be in the `4xx` or `5xx` range (must be greater than or equal to `400`).
|
|
41
42
|
*
|
|
42
43
|
* @default COMMON_ERROR_STATUS_MAP, DEFAULT_ERROR_STATUS
|
|
43
44
|
*/
|
|
@@ -43,7 +43,8 @@ interface OpenAPIMeta {
|
|
|
43
43
|
*/
|
|
44
44
|
tags?: string[] | undefined;
|
|
45
45
|
/**
|
|
46
|
-
* HTTP status code returned on success.
|
|
46
|
+
* HTTP status code returned on success.
|
|
47
|
+
* Should be in the `2xx` range and must be less than `400`.
|
|
47
48
|
*
|
|
48
49
|
* @default 200
|
|
49
50
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.15",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -75,14 +75,14 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@hey-api/spec-types": "0.0.0-next-20260408030107",
|
|
78
|
-
"@standardserver/core": "^0.0.
|
|
79
|
-
"@standardserver/fetch": "^0.0.
|
|
78
|
+
"@standardserver/core": "^0.0.32",
|
|
79
|
+
"@standardserver/fetch": "^0.0.32",
|
|
80
80
|
"rou3": "^0.8.1",
|
|
81
|
-
"@orpc/
|
|
82
|
-
"@orpc/
|
|
83
|
-
"@orpc/server": "2.0.0-beta.
|
|
84
|
-
"@orpc/
|
|
85
|
-
"@orpc/
|
|
81
|
+
"@orpc/contract": "2.0.0-beta.15",
|
|
82
|
+
"@orpc/json-schema": "2.0.0-beta.15",
|
|
83
|
+
"@orpc/server": "2.0.0-beta.15",
|
|
84
|
+
"@orpc/shared": "2.0.0-beta.15",
|
|
85
|
+
"@orpc/client": "2.0.0-beta.15"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@scalar/api-reference": "^1.57.2",
|