@orpc/openapi 2.0.0-beta.33 → 2.0.0-beta.34

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.
Files changed (36) hide show
  1. package/dist/adapters/aws-lambda/index.d.mts +2 -2
  2. package/dist/adapters/aws-lambda/index.d.ts +2 -2
  3. package/dist/adapters/aws-lambda/index.mjs +3 -3
  4. package/dist/adapters/fastify/index.d.mts +2 -2
  5. package/dist/adapters/fastify/index.d.ts +2 -2
  6. package/dist/adapters/fastify/index.mjs +3 -3
  7. package/dist/adapters/fetch/index.d.mts +2 -2
  8. package/dist/adapters/fetch/index.d.ts +2 -2
  9. package/dist/adapters/fetch/index.mjs +5 -5
  10. package/dist/adapters/node/index.d.mts +2 -2
  11. package/dist/adapters/node/index.d.ts +2 -2
  12. package/dist/adapters/node/index.mjs +3 -3
  13. package/dist/adapters/standard/index.d.mts +3 -3
  14. package/dist/adapters/standard/index.d.ts +3 -3
  15. package/dist/adapters/standard/index.mjs +5 -5
  16. package/dist/extensions/route.d.mts +4 -6
  17. package/dist/extensions/route.d.ts +4 -6
  18. package/dist/index.d.mts +26 -11
  19. package/dist/index.d.ts +26 -11
  20. package/dist/index.mjs +28 -14
  21. package/dist/plugins/index.d.mts +4 -4
  22. package/dist/plugins/index.d.ts +4 -4
  23. package/dist/shared/{openapi.BPD9gS3x.mjs → openapi.0Vlm07ar.mjs} +4 -4
  24. package/dist/shared/{openapi.9smDzQwj.d.mts → openapi.1dpot5Co.d.ts} +2 -2
  25. package/dist/shared/{openapi.Bd9icEUa.d.mts → openapi.BV8YPh6e.d.mts} +2 -2
  26. package/dist/shared/{openapi.D1CqEIRy.d.ts → openapi.BbwbMAMG.d.ts} +2 -2
  27. package/dist/shared/{openapi.YCiBHaJ-.d.ts → openapi.C1cJ95us.d.mts} +2 -2
  28. package/dist/shared/{openapi.DfTTLtn5.d.ts → openapi.CXSHZ431.d.mts} +12 -13
  29. package/dist/shared/{openapi.DfTTLtn5.d.mts → openapi.CXSHZ431.d.ts} +12 -13
  30. package/dist/shared/{openapi.Drcd0PuL.d.mts → openapi.Cem81Zhm.d.mts} +6 -3
  31. package/dist/shared/{openapi.DTYZZ6Ph.d.ts → openapi.Cem81Zhm.d.ts} +6 -3
  32. package/dist/shared/{openapi.0yE-t1W-.mjs → openapi.Cz2PauNH.mjs} +1 -1
  33. package/dist/shared/{openapi.Dz-JaXHo.d.mts → openapi.DXWj9fY8.d.mts} +1 -1
  34. package/dist/shared/{openapi.Dz-JaXHo.d.ts → openapi.DXWj9fY8.d.ts} +1 -1
  35. package/dist/shared/{openapi.BITX91Fj.mjs → openapi.Dxn8HAW0.mjs} +2 -2
  36. package/package.json +11 -10
@@ -4,9 +4,9 @@ import { StandardHandlerOptions } from '@orpc/server/standard';
4
4
  import { OpenAPIHandlerCodecOptions } from '../standard/index.mjs';
5
5
  import '@orpc/client';
6
6
  import '@orpc/shared';
7
- import '@standardserver/core';
7
+ import '@standard-server/core';
8
8
  import '@orpc/contract';
9
- import '../../shared/openapi.Dz-JaXHo.mjs';
9
+ import '../../shared/openapi.DXWj9fY8.mjs';
10
10
 
11
11
  interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
12
12
  }
@@ -4,9 +4,9 @@ import { StandardHandlerOptions } from '@orpc/server/standard';
4
4
  import { OpenAPIHandlerCodecOptions } from '../standard/index.js';
5
5
  import '@orpc/client';
6
6
  import '@orpc/shared';
7
- import '@standardserver/core';
7
+ import '@standard-server/core';
8
8
  import '@orpc/contract';
9
- import '../../shared/openapi.Dz-JaXHo.js';
9
+ import '../../shared/openapi.DXWj9fY8.js';
10
10
 
11
11
  interface OpenAPIHandlerOptions<T extends Context> extends AwsLambdaHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
12
12
  }
@@ -1,11 +1,11 @@
1
1
  import { AwsLambdaHandler } from '@orpc/server/aws-lambda';
2
2
  import { StandardHandler } from '@orpc/server/standard';
3
- import { O as OpenAPIHandlerCodec } from '../../shared/openapi.BITX91Fj.mjs';
3
+ import { O as OpenAPIHandlerCodec } from '../../shared/openapi.Dxn8HAW0.mjs';
4
4
  import '@orpc/client';
5
5
  import '@orpc/server';
6
6
  import '@orpc/shared';
7
- import '@standardserver/core';
8
- import '../../shared/openapi.0yE-t1W-.mjs';
7
+ import '@standard-server/core';
8
+ import '../../shared/openapi.Cz2PauNH.mjs';
9
9
  import '../../shared/openapi.s_p5sN-P.mjs';
10
10
  import '../../shared/openapi.B9PQzqBn.mjs';
11
11
  import 'rou3';
@@ -4,9 +4,9 @@ import { StandardHandlerOptions } from '@orpc/server/standard';
4
4
  import { OpenAPIHandlerCodecOptions } from '../standard/index.mjs';
5
5
  import '@orpc/client';
6
6
  import '@orpc/shared';
7
- import '@standardserver/core';
7
+ import '@standard-server/core';
8
8
  import '@orpc/contract';
9
- import '../../shared/openapi.Dz-JaXHo.mjs';
9
+ import '../../shared/openapi.DXWj9fY8.mjs';
10
10
 
11
11
  interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
12
12
  }
@@ -4,9 +4,9 @@ import { StandardHandlerOptions } from '@orpc/server/standard';
4
4
  import { OpenAPIHandlerCodecOptions } from '../standard/index.js';
5
5
  import '@orpc/client';
6
6
  import '@orpc/shared';
7
- import '@standardserver/core';
7
+ import '@standard-server/core';
8
8
  import '@orpc/contract';
9
- import '../../shared/openapi.Dz-JaXHo.js';
9
+ import '../../shared/openapi.DXWj9fY8.js';
10
10
 
11
11
  interface OpenAPIHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
12
12
  }
@@ -1,11 +1,11 @@
1
1
  import { FastifyHandler } from '@orpc/server/fastify';
2
2
  import { StandardHandler } from '@orpc/server/standard';
3
- import { O as OpenAPIHandlerCodec } from '../../shared/openapi.BITX91Fj.mjs';
3
+ import { O as OpenAPIHandlerCodec } from '../../shared/openapi.Dxn8HAW0.mjs';
4
4
  import '@orpc/client';
5
5
  import '@orpc/server';
6
6
  import '@orpc/shared';
7
- import '@standardserver/core';
8
- import '../../shared/openapi.0yE-t1W-.mjs';
7
+ import '@standard-server/core';
8
+ import '../../shared/openapi.Cz2PauNH.mjs';
9
9
  import '../../shared/openapi.s_p5sN-P.mjs';
10
10
  import '../../shared/openapi.B9PQzqBn.mjs';
11
11
  import 'rou3';
@@ -8,8 +8,8 @@ import { StandardLink, StandardLinkOptions } from '@orpc/client/standard';
8
8
  import { RouterContract } from '@orpc/contract';
9
9
  import { OpenAPILinkCodecOptions } from '../standard/index.mjs';
10
10
  import '@orpc/shared';
11
- import '@standardserver/core';
12
- import '../../shared/openapi.Dz-JaXHo.mjs';
11
+ import '@standard-server/core';
12
+ import '../../shared/openapi.DXWj9fY8.mjs';
13
13
 
14
14
  interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
15
15
  }
@@ -8,8 +8,8 @@ import { StandardLink, StandardLinkOptions } from '@orpc/client/standard';
8
8
  import { RouterContract } from '@orpc/contract';
9
9
  import { OpenAPILinkCodecOptions } from '../standard/index.js';
10
10
  import '@orpc/shared';
11
- import '@standardserver/core';
12
- import '../../shared/openapi.Dz-JaXHo.js';
11
+ import '@standard-server/core';
12
+ import '../../shared/openapi.DXWj9fY8.js';
13
13
 
14
14
  interface OpenAPIHandlerOptions<T extends Context> extends FetchHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
15
15
  }
@@ -1,19 +1,19 @@
1
1
  import { FetchHandler } from '@orpc/server/fetch';
2
2
  import { StandardHandler } from '@orpc/server/standard';
3
- import { O as OpenAPIHandlerCodec } from '../../shared/openapi.BITX91Fj.mjs';
3
+ import { O as OpenAPIHandlerCodec } from '../../shared/openapi.Dxn8HAW0.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.BPD9gS3x.mjs';
6
+ import { O as OpenAPILinkCodec } from '../../shared/openapi.0Vlm07ar.mjs';
7
7
  import '@orpc/client';
8
8
  import '@orpc/server';
9
9
  import '@orpc/shared';
10
- import '@standardserver/core';
11
- import '../../shared/openapi.0yE-t1W-.mjs';
10
+ import '@standard-server/core';
11
+ import '../../shared/openapi.Cz2PauNH.mjs';
12
12
  import '../../shared/openapi.s_p5sN-P.mjs';
13
13
  import '../../shared/openapi.B9PQzqBn.mjs';
14
14
  import 'rou3';
15
15
  import '@orpc/contract';
16
- import '@standardserver/fetch';
16
+ import '@standard-server/fetch';
17
17
 
18
18
  class OpenAPIHandler extends FetchHandler {
19
19
  constructor(router, options = {}) {
@@ -4,9 +4,9 @@ import { StandardHandlerOptions } from '@orpc/server/standard';
4
4
  import { OpenAPIHandlerCodecOptions } from '../standard/index.mjs';
5
5
  import '@orpc/client';
6
6
  import '@orpc/shared';
7
- import '@standardserver/core';
7
+ import '@standard-server/core';
8
8
  import '@orpc/contract';
9
- import '../../shared/openapi.Dz-JaXHo.mjs';
9
+ import '../../shared/openapi.DXWj9fY8.mjs';
10
10
 
11
11
  interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
12
12
  }
@@ -4,9 +4,9 @@ import { StandardHandlerOptions } from '@orpc/server/standard';
4
4
  import { OpenAPIHandlerCodecOptions } from '../standard/index.js';
5
5
  import '@orpc/client';
6
6
  import '@orpc/shared';
7
- import '@standardserver/core';
7
+ import '@standard-server/core';
8
8
  import '@orpc/contract';
9
- import '../../shared/openapi.Dz-JaXHo.js';
9
+ import '../../shared/openapi.DXWj9fY8.js';
10
10
 
11
11
  interface OpenAPIHandlerOptions<T extends Context> extends NodeHttpHandlerOptions<T>, Omit<StandardHandlerOptions<T>, 'plugins'>, OpenAPIHandlerCodecOptions<T> {
12
12
  }
@@ -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.BITX91Fj.mjs';
3
+ import { O as OpenAPIHandlerCodec } from '../../shared/openapi.Dxn8HAW0.mjs';
4
4
  import '@orpc/client';
5
5
  import '@orpc/server';
6
6
  import '@orpc/shared';
7
- import '@standardserver/core';
8
- import '../../shared/openapi.0yE-t1W-.mjs';
7
+ import '@standard-server/core';
8
+ import '../../shared/openapi.Cz2PauNH.mjs';
9
9
  import '../../shared/openapi.s_p5sN-P.mjs';
10
10
  import '../../shared/openapi.B9PQzqBn.mjs';
11
11
  import 'rou3';
@@ -1,6 +1,6 @@
1
- export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.9smDzQwj.mjs';
2
- export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.Bd9icEUa.mjs';
3
- import { StandardHeaders } from '@standardserver/core';
1
+ export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.C1cJ95us.mjs';
2
+ export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.BV8YPh6e.mjs';
3
+ import { StandardHeaders } from '@standard-server/core';
4
4
  import { OpenAPISerializer } from '../../index.mjs';
5
5
  import '@orpc/client';
6
6
  import '@orpc/server';
@@ -1,6 +1,6 @@
1
- export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.YCiBHaJ-.js';
2
- export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.D1CqEIRy.js';
3
- import { StandardHeaders } from '@standardserver/core';
1
+ export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.1dpot5Co.js';
2
+ export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.BbwbMAMG.js';
3
+ import { StandardHeaders } from '@standard-server/core';
4
4
  import { OpenAPISerializer } from '../../index.js';
5
5
  import '@orpc/client';
6
6
  import '@orpc/server';
@@ -1,12 +1,12 @@
1
- export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher, s as serializeHeaders } from '../../shared/openapi.BITX91Fj.mjs';
2
- export { O as OpenAPILinkCodec } from '../../shared/openapi.BPD9gS3x.mjs';
1
+ export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher, s as serializeHeaders } from '../../shared/openapi.Dxn8HAW0.mjs';
2
+ export { O as OpenAPILinkCodec } from '../../shared/openapi.0Vlm07ar.mjs';
3
3
  import '@orpc/client';
4
4
  import '@orpc/server';
5
5
  import '@orpc/shared';
6
- import '@standardserver/core';
7
- import '../../shared/openapi.0yE-t1W-.mjs';
6
+ import '@standard-server/core';
7
+ import '../../shared/openapi.Cz2PauNH.mjs';
8
8
  import '../../shared/openapi.s_p5sN-P.mjs';
9
9
  import '../../shared/openapi.B9PQzqBn.mjs';
10
10
  import 'rou3';
11
11
  import '@orpc/contract';
12
- import '@standardserver/fetch';
12
+ import '@standard-server/fetch';
@@ -1,11 +1,9 @@
1
- import { AnyORPCError } from '@orpc/client';
2
1
  import { ErrorMap, AnySchema } from '@orpc/contract';
3
2
  import { Context } from '@orpc/server';
4
3
  import { OpenAPIMeta } from '../index.mjs';
5
4
  import '@orpc/shared';
6
- import '@standardserver/core';
7
- import '../shared/openapi.DfTTLtn5.mjs';
8
- import '@hey-api/spec-types';
5
+ import '@standard-server/core';
6
+ import '@openapi-spec/types';
9
7
 
10
8
  declare module '@orpc/contract' {
11
9
  interface ContractBuilder<TErrorMap extends ErrorMap> {
@@ -37,7 +35,7 @@ declare module '@orpc/server' {
37
35
  interface BuilderWithInputOutput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
38
36
  route(meta: OpenAPIMeta): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
39
37
  }
40
- interface DecoratedProcedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError> {
41
- route(meta: OpenAPIMeta): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap, TReturnedError>;
38
+ interface DecoratedProcedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
39
+ route(meta: OpenAPIMeta): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
42
40
  }
43
41
  }
@@ -1,11 +1,9 @@
1
- import { AnyORPCError } from '@orpc/client';
2
1
  import { ErrorMap, AnySchema } from '@orpc/contract';
3
2
  import { Context } from '@orpc/server';
4
3
  import { OpenAPIMeta } from '../index.js';
5
4
  import '@orpc/shared';
6
- import '@standardserver/core';
7
- import '../shared/openapi.DfTTLtn5.js';
8
- import '@hey-api/spec-types';
5
+ import '@standard-server/core';
6
+ import '@openapi-spec/types';
9
7
 
10
8
  declare module '@orpc/contract' {
11
9
  interface ContractBuilder<TErrorMap extends ErrorMap> {
@@ -37,7 +35,7 @@ declare module '@orpc/server' {
37
35
  interface BuilderWithInputOutput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
38
36
  route(meta: OpenAPIMeta): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
39
37
  }
40
- interface DecoratedProcedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError> {
41
- route(meta: OpenAPIMeta): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap, TReturnedError>;
38
+ interface DecoratedProcedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
39
+ route(meta: OpenAPIMeta): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
42
40
  }
43
41
  }
package/dist/index.d.mts CHANGED
@@ -1,16 +1,17 @@
1
- import { O as OpenAPISerializer } from './shared/openapi.Dz-JaXHo.mjs';
2
- export { B as BracketNotationSerializeResult, a as BracketNotationSerializer, b as BracketNotationSerializerOptions, c as OpenAPIJsonSerialization, d as OpenAPIJsonSerializer, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions, g as OpenAPISerializerOptions, h as OpenAPISerializerSerializeOptions } from './shared/openapi.Dz-JaXHo.mjs';
1
+ import { O as OpenAPISerializer } from './shared/openapi.DXWj9fY8.mjs';
2
+ export { B as BracketNotationSerializeResult, a as BracketNotationSerializer, b as BracketNotationSerializerOptions, c as OpenAPIJsonSerialization, d as OpenAPIJsonSerializer, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions, g as OpenAPISerializerOptions, h as OpenAPISerializerSerializeOptions } from './shared/openapi.DXWj9fY8.mjs';
3
3
  import { ClientContext, ORPCClientOptions, ClientLink } from '@orpc/client';
4
4
  export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
5
5
  import { RouterContract, RouterContractClient, AnyProcedureContract, ProcedureContract } from '@orpc/contract';
6
- import { J as JsonifiedClient, O as OpenAPIDocument } from './shared/openapi.DfTTLtn5.mjs';
7
- export { a as JsonifiedArray, b as JsonifiedClientError, c as JsonifiedValue, d as OpenAPIOperationObject } from './shared/openapi.DfTTLtn5.mjs';
8
- 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.Drcd0PuL.mjs';
6
+ import { J as JsonifiedClient, O as OpenAPIVersion, a as OpenAPIDocument } from './shared/openapi.CXSHZ431.mjs';
7
+ export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.CXSHZ431.mjs';
8
+ 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.Cem81Zhm.mjs';
9
9
  import { JsonSchema, JsonSchemaConverter } from '@orpc/json-schema';
10
10
  import { AnyRouter, AnyProcedure } from '@orpc/server';
11
11
  import { Value } from '@orpc/shared';
12
- export { StandardBodyHint } from '@standardserver/core';
13
- import '@hey-api/spec-types';
12
+ import { OpenAPIV3_2 } from '@openapi-spec/types';
13
+ export { OpenAPIV3_0, OpenAPIV3_1, OpenAPIV3_2 } from '@openapi-spec/types';
14
+ export { StandardBodyHint } from '@standard-server/core';
14
15
 
15
16
  interface ContractJsonifiedClientFactory<TClientContext extends ClientContext> {
16
17
  <T extends RouterContract>(contract: T): JsonifiedClient<RouterContractClient<T, TClientContext>>;
@@ -61,8 +62,21 @@ interface OpenAPIGeneratorOptions {
61
62
  */
62
63
  serializer?: Pick<OpenAPISerializer, keyof OpenAPISerializer> | undefined;
63
64
  }
64
- interface OpenAPIGeneratorGenerateOptions {
65
- base?: Partial<OpenAPIDocument> | undefined;
65
+ interface OpenAPIGeneratorGenerateOptions<TVersion extends OpenAPIVersion> {
66
+ /**
67
+ * The OpenAPI version of the generated document.
68
+ * The document is generated as OpenAPI 3.2 and downgraded when an older version is requested.
69
+ * The minor version selects the conversion, the document carries the exact value, such as `3.1.0`.
70
+ *
71
+ * @default '3.2.0'
72
+ */
73
+ version?: TVersion | undefined;
74
+ /**
75
+ * OpenAPI 3.2 document fields to start from, such as `info`, `servers`, or `components`.
76
+ * They are downgraded with the rest of the document when an older `version` is requested.
77
+ * The `openapi` field is derived from `version`.
78
+ */
79
+ base?: Partial<Omit<OpenAPIV3_2.OpenAPIObject, 'openapi'>> | undefined;
66
80
  /**
67
81
  * Root-level `$defs` are always moved into `components.schemas`.
68
82
  * Use this to customize the component name of a hoisted def.
@@ -87,6 +101,7 @@ interface OpenAPIGeneratorGenerateOptions {
87
101
  *
88
102
  * @remarks
89
103
  * - Return `null | undefined` to use the default error response body shaper.
104
+ * - The schema is an OpenAPI 3.2 Schema Object, it is downgraded with the rest of the document when an older `version` is requested.
90
105
  */
91
106
  customErrorResponseBodySchema?: Value<JsonSchema | undefined | null, [
92
107
  definedErrors: OpenAPIErrorBodyDefinition[],
@@ -109,7 +124,7 @@ declare class OpenAPIGenerator {
109
124
  private readonly serializer;
110
125
  private readonly converter;
111
126
  constructor(options?: OpenAPIGeneratorOptions);
112
- generate(router: RouterContract | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPIDocument>;
127
+ generate<TVersion extends OpenAPIVersion = '3.2.0'>(router: RouterContract | AnyRouter, options?: OpenAPIGeneratorGenerateOptions<TVersion>): Promise<OpenAPIDocument<TVersion>>;
113
128
  private convertSchema;
114
129
  private convertSchemas;
115
130
  }
@@ -133,5 +148,5 @@ interface PopulateRouterContractOpenAPIPathsOptions {
133
148
  */
134
149
  declare function populateRouterContractOpenAPIPaths<T extends RouterContract>(router: T, options?: PopulateRouterContractOpenAPIPathsOptions): PopulatedContractRouterOpenAPIPaths<T>;
135
150
 
136
- export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, createContractJsonifiedClientFactory, getDynamicPathParams, isBodylessMethod, populateRouterContractOpenAPIPaths };
151
+ export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, OpenAPIVersion, createContractJsonifiedClientFactory, getDynamicPathParams, isBodylessMethod, populateRouterContractOpenAPIPaths };
137
152
  export type { ContractJsonifiedClientFactory, ContractJsonifiedClientFactoryOptions, OpenAPIErrorBodyDefinition, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions, PopulateRouterContractOpenAPIPathsOptions, PopulatedContractRouterOpenAPIPaths };
package/dist/index.d.ts CHANGED
@@ -1,16 +1,17 @@
1
- import { O as OpenAPISerializer } from './shared/openapi.Dz-JaXHo.js';
2
- export { B as BracketNotationSerializeResult, a as BracketNotationSerializer, b as BracketNotationSerializerOptions, c as OpenAPIJsonSerialization, d as OpenAPIJsonSerializer, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions, g as OpenAPISerializerOptions, h as OpenAPISerializerSerializeOptions } from './shared/openapi.Dz-JaXHo.js';
1
+ import { O as OpenAPISerializer } from './shared/openapi.DXWj9fY8.js';
2
+ export { B as BracketNotationSerializeResult, a as BracketNotationSerializer, b as BracketNotationSerializerOptions, c as OpenAPIJsonSerialization, d as OpenAPIJsonSerializer, e as OpenAPIJsonSerializerHandler, f as OpenAPIJsonSerializerOptions, g as OpenAPISerializerOptions, h as OpenAPISerializerSerializeOptions } from './shared/openapi.DXWj9fY8.js';
3
3
  import { ClientContext, ORPCClientOptions, ClientLink } from '@orpc/client';
4
4
  export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
5
5
  import { RouterContract, RouterContractClient, AnyProcedureContract, ProcedureContract } from '@orpc/contract';
6
- import { J as JsonifiedClient, O as OpenAPIDocument } from './shared/openapi.DfTTLtn5.js';
7
- export { a as JsonifiedArray, b as JsonifiedClientError, c as JsonifiedValue, d as OpenAPIOperationObject } from './shared/openapi.DfTTLtn5.js';
8
- 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.DTYZZ6Ph.js';
6
+ import { J as JsonifiedClient, O as OpenAPIVersion, a as OpenAPIDocument } from './shared/openapi.CXSHZ431.js';
7
+ export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.CXSHZ431.js';
8
+ 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.Cem81Zhm.js';
9
9
  import { JsonSchema, JsonSchemaConverter } from '@orpc/json-schema';
10
10
  import { AnyRouter, AnyProcedure } from '@orpc/server';
11
11
  import { Value } from '@orpc/shared';
12
- export { StandardBodyHint } from '@standardserver/core';
13
- import '@hey-api/spec-types';
12
+ import { OpenAPIV3_2 } from '@openapi-spec/types';
13
+ export { OpenAPIV3_0, OpenAPIV3_1, OpenAPIV3_2 } from '@openapi-spec/types';
14
+ export { StandardBodyHint } from '@standard-server/core';
14
15
 
15
16
  interface ContractJsonifiedClientFactory<TClientContext extends ClientContext> {
16
17
  <T extends RouterContract>(contract: T): JsonifiedClient<RouterContractClient<T, TClientContext>>;
@@ -61,8 +62,21 @@ interface OpenAPIGeneratorOptions {
61
62
  */
62
63
  serializer?: Pick<OpenAPISerializer, keyof OpenAPISerializer> | undefined;
63
64
  }
64
- interface OpenAPIGeneratorGenerateOptions {
65
- base?: Partial<OpenAPIDocument> | undefined;
65
+ interface OpenAPIGeneratorGenerateOptions<TVersion extends OpenAPIVersion> {
66
+ /**
67
+ * The OpenAPI version of the generated document.
68
+ * The document is generated as OpenAPI 3.2 and downgraded when an older version is requested.
69
+ * The minor version selects the conversion, the document carries the exact value, such as `3.1.0`.
70
+ *
71
+ * @default '3.2.0'
72
+ */
73
+ version?: TVersion | undefined;
74
+ /**
75
+ * OpenAPI 3.2 document fields to start from, such as `info`, `servers`, or `components`.
76
+ * They are downgraded with the rest of the document when an older `version` is requested.
77
+ * The `openapi` field is derived from `version`.
78
+ */
79
+ base?: Partial<Omit<OpenAPIV3_2.OpenAPIObject, 'openapi'>> | undefined;
66
80
  /**
67
81
  * Root-level `$defs` are always moved into `components.schemas`.
68
82
  * Use this to customize the component name of a hoisted def.
@@ -87,6 +101,7 @@ interface OpenAPIGeneratorGenerateOptions {
87
101
  *
88
102
  * @remarks
89
103
  * - Return `null | undefined` to use the default error response body shaper.
104
+ * - The schema is an OpenAPI 3.2 Schema Object, it is downgraded with the rest of the document when an older `version` is requested.
90
105
  */
91
106
  customErrorResponseBodySchema?: Value<JsonSchema | undefined | null, [
92
107
  definedErrors: OpenAPIErrorBodyDefinition[],
@@ -109,7 +124,7 @@ declare class OpenAPIGenerator {
109
124
  private readonly serializer;
110
125
  private readonly converter;
111
126
  constructor(options?: OpenAPIGeneratorOptions);
112
- generate(router: RouterContract | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPIDocument>;
127
+ generate<TVersion extends OpenAPIVersion = '3.2.0'>(router: RouterContract | AnyRouter, options?: OpenAPIGeneratorGenerateOptions<TVersion>): Promise<OpenAPIDocument<TVersion>>;
113
128
  private convertSchema;
114
129
  private convertSchemas;
115
130
  }
@@ -133,5 +148,5 @@ interface PopulateRouterContractOpenAPIPathsOptions {
133
148
  */
134
149
  declare function populateRouterContractOpenAPIPaths<T extends RouterContract>(router: T, options?: PopulateRouterContractOpenAPIPathsOptions): PopulatedContractRouterOpenAPIPaths<T>;
135
150
 
136
- export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, createContractJsonifiedClientFactory, getDynamicPathParams, isBodylessMethod, populateRouterContractOpenAPIPaths };
151
+ export { DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_METHOD, DEFAULT_OPENAPI_OUTPUT_STRUCTURE, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, JsonifiedClient, OpenAPIDocument, OpenAPIGenerator, OpenAPIGeneratorError, OpenAPISerializer, OpenAPIVersion, createContractJsonifiedClientFactory, getDynamicPathParams, isBodylessMethod, populateRouterContractOpenAPIPaths };
137
152
  export type { ContractJsonifiedClientFactory, ContractJsonifiedClientFactoryOptions, OpenAPIErrorBodyDefinition, OpenAPIGeneratorGenerateOptions, OpenAPIGeneratorOptions, PopulateRouterContractOpenAPIPathsOptions, PopulatedContractRouterOpenAPIPaths };
package/dist/index.mjs CHANGED
@@ -1,14 +1,15 @@
1
1
  export { B as BracketNotationSerializer } from './shared/openapi.s_p5sN-P.mjs';
2
2
  import { createContractClientFactory, getAsyncIteratorObjectSchemaDetails, ProcedureContract, resolveMetaPlugins } from '@orpc/contract';
3
- import { D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, c as DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE, i as isBodylessMethod, O as OpenAPISerializer, g as getDynamicPathParams } from './shared/openapi.0yE-t1W-.mjs';
4
- export { d as OpenAPIJsonSerializer } from './shared/openapi.0yE-t1W-.mjs';
3
+ import { D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, c as DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE, i as isBodylessMethod, O as OpenAPISerializer, g as getDynamicPathParams } from './shared/openapi.Cz2PauNH.mjs';
4
+ export { d as OpenAPIJsonSerializer } from './shared/openapi.Cz2PauNH.mjs';
5
5
  import { g as getOpenAPIMeta, o as openapi } from './shared/openapi.B9PQzqBn.mjs';
6
+ import { downgradeSpecV32ToV31, downgradeSpecV31ToV30 } from '@openapi-spec/downgrader';
6
7
  import { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
7
8
  export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
8
9
  import { encodeJsonPointerSegment, ensureJsonSchemaObject, mapJsonSchemaRefs, decodeJsonPointerSegment, isUnconstrainedSchema, combineJsonSchemasWithComposition, extractJsonObjectSchemaEntries, combineJsonObjectSchemaEntries, flattenJsonUnionSchema, isJsonPrimitiveSchema, matchArrayableJsonSchema, isJsonFileSchema, DelegatingJsonSchemaConverter, StandardJsonSchemaConverter } from '@orpc/json-schema';
9
10
  import { DEFAULT_SUCCESS_STATUS, DEFAULT_ERROR_STATUS, walkProcedureContractsAsync } from '@orpc/server';
10
11
  import { isDeepEqual, value, findDeepMatches, isPlainObject, stringifyJSON, toArray, clone, pathToHttpPath, mergeHttpPath, isTypescriptObject } from '@orpc/shared';
11
- import '@standardserver/core';
12
+ import '@standard-server/core';
12
13
 
13
14
  function createContractJsonifiedClientFactory(link, options = {}) {
14
15
  return createContractClientFactory(link, options);
@@ -418,6 +419,12 @@ function renderPathParameters(ctx, operation, dynamicParams, paramsEntries, para
418
419
  Schema keys: ${paramsEntries.map(([n]) => n).join(", ") || "(none)"}`
419
420
  );
420
421
  }
422
+ if (entry[2]) {
423
+ throw new OpenAPIGeneratorError(
424
+ `dynamic param "${name}" is optional in the input schema.
425
+ OpenAPI requires path params to be required. Make "${name}" required.`
426
+ );
427
+ }
421
428
  const style = paramsStyles?.[name];
422
429
  const parameter = {
423
430
  in: "path",
@@ -489,7 +496,7 @@ function buildSuccessResponse(ctx, operation, def, meta) {
489
496
  const iteratorDetails = getAsyncIteratorObjectDetails(def.outputSchemas);
490
497
  if (iteratorDetails) {
491
498
  operation.responses ??= {};
492
- operation.responses[status] = {
499
+ operation.responses[toResponseStatusKey(status)] = {
493
500
  description,
494
501
  content: toAsyncIteratorObjectContent(
495
502
  ctx,
@@ -504,7 +511,7 @@ function buildSuccessResponse(ctx, operation, def, meta) {
504
511
  const [schema] = ctx.convertSchemas(def.outputSchemas, "output");
505
512
  if (isUnconstrainedSchema(schema) || outputStructure === "compact") {
506
513
  operation.responses ??= {};
507
- operation.responses[status] = {
514
+ operation.responses[toResponseStatusKey(status)] = {
508
515
  description,
509
516
  content: toBodyContent(ctx, "output", schema)
510
517
  };
@@ -528,9 +535,12 @@ function buildSuccessResponse(ctx, operation, def, meta) {
528
535
  });
529
536
  }
530
537
  operation.responses ??= {};
531
- operation.responses[responseStatus] = responseObject;
538
+ operation.responses[toResponseStatusKey(responseStatus)] = responseObject;
532
539
  }
533
540
  }
541
+ function toResponseStatusKey(status) {
542
+ return String(status);
543
+ }
534
544
  function extractDetailedResponseParts(schema, defaultStatus) {
535
545
  const partsByStatus = /* @__PURE__ */ new Map();
536
546
  for (const item of flattenJsonUnionSchema(schema)) {
@@ -592,13 +602,12 @@ function buildErrorResponse(ctx, operation, def) {
592
602
  type: "object",
593
603
  properties: {
594
604
  defined: { const: false },
595
- inferable: { type: "boolean" },
596
605
  code: { type: "string" },
597
606
  status: { type: "number" },
598
607
  message: { type: "string" },
599
608
  data: {}
600
609
  },
601
- required: ["defined", "inferable", "code", "status", "message"]
610
+ required: ["defined", "code", "status", "message"]
602
611
  });
603
612
  for (const [status, definitions] of definitionsByStatus.entries()) {
604
613
  const descriptions = definitions.map(({ defaultMessage }) => defaultMessage).filter((m) => m !== void 0);
@@ -611,7 +620,6 @@ function buildErrorResponse(ctx, operation, def) {
611
620
  ...definitions.map(({ code, dataJsonSchema, dataOptional }) => {
612
621
  return ctx.registry.register(toErrorComponentName(code), combineJsonObjectSchemaEntries([
613
622
  ["defined", { const: true }, false],
614
- ["inferable", { type: "boolean" }, false],
615
623
  ["code", { const: code }, false],
616
624
  ["status", { const: status }, false],
617
625
  // avoid using the defaultMessage here to improve component reusability
@@ -622,7 +630,7 @@ function buildErrorResponse(ctx, operation, def) {
622
630
  undefinedErrorSchema
623
631
  ]);
624
632
  operation.responses ??= {};
625
- operation.responses[status] = {
633
+ operation.responses[toResponseStatusKey(status)] = {
626
634
  description: descriptions.length ? descriptions.join(", ") : status.toString(),
627
635
  content: {
628
636
  "application/json": {
@@ -736,9 +744,10 @@ class OpenAPIGenerator {
736
744
  ]);
737
745
  }
738
746
  async generate(router, options = {}) {
747
+ const version = options.version ?? "3.2.0";
739
748
  const doc = {
740
749
  ...clone(options.base),
741
- openapi: options.base?.openapi ?? "3.1.2",
750
+ openapi: "3.2.0",
742
751
  info: options.base?.info ?? { title: "API Reference", version: "0.0.0" }
743
752
  };
744
753
  const ctx = {
@@ -756,9 +765,9 @@ class OpenAPIGenerator {
756
765
  const def = contract["~orpc"];
757
766
  const meta = getOpenAPIMeta(contract);
758
767
  const method = (meta?.method ?? DEFAULT_OPENAPI_METHOD).toLowerCase();
759
- if (method === "query" && doc.openapi !== "3.2.0") {
768
+ if (method === "query" && !version.startsWith("3.2.")) {
760
769
  throw new OpenAPIGeneratorError(
761
- `QUERY operations require OpenAPI 3.2. Set base.openapi to '3.2.0'.`
770
+ `QUERY operations require OpenAPI 3.2, but version "${version}" was requested.`
762
771
  );
763
772
  }
764
773
  const postPath = meta?.path ?? pathToHttpPath(path);
@@ -800,7 +809,8 @@ class OpenAPIGenerator {
800
809
  ${errors.join("\n\n")}`
801
810
  );
802
811
  }
803
- return this.serializer.serialize(doc, { asFormData: false, useFormDataForBlobFields: false });
812
+ const versioned = toVersionedOpenAPIDocument(doc, version);
813
+ return this.serializer.serialize(versioned, { asFormData: false, useFormDataForBlobFields: false });
804
814
  }
805
815
  convertSchema(schema, direction) {
806
816
  const [jsonSchema, optional] = this.converter.convert(schema, direction);
@@ -817,6 +827,10 @@ ${errors.join("\n\n")}`
817
827
  ];
818
828
  }
819
829
  }
830
+ function toVersionedOpenAPIDocument(doc, version) {
831
+ const downgraded = version.startsWith("3.2.") ? doc : version.startsWith("3.1.") ? downgradeSpecV32ToV31(doc) : downgradeSpecV31ToV30(downgradeSpecV32ToV31(doc));
832
+ return { ...downgraded, openapi: version };
833
+ }
820
834
  function strip$schemaField(schema) {
821
835
  if (typeof schema !== "object") {
822
836
  return schema;
@@ -2,10 +2,10 @@ import { Context } from '@orpc/server';
2
2
  import { StandardHandlerPlugin, StandardHandlerRoutingInterceptorOptions, StandardHandlerOptions } from '@orpc/server/standard';
3
3
  import { Value, Promisable } from '@orpc/shared';
4
4
  import { ApiReferenceConfiguration } from '@scalar/api-reference';
5
- import { StandardUrl } from '@standardserver/core';
5
+ import { StandardUrl } from '@standard-server/core';
6
6
  import { SwaggerUIOptions } from 'swagger-ui';
7
- import { OpenAPIDocument } from '../index.mjs';
8
- import '@hey-api/spec-types';
7
+ import { OpenAPIDocument, OpenAPIVersion } from '../index.mjs';
8
+ import '@openapi-spec/types';
9
9
  import '@orpc/client';
10
10
 
11
11
  type OpenAPIReferenceHandlerPluginProvider = 'scalar' | 'swagger';
@@ -21,7 +21,7 @@ interface OpenAPIReferenceHandlerPluginOptions<T extends Context, TProvider exte
21
21
  * A static or dynamic OpenAPI document to serve.
22
22
  * Receives routing interceptor options when provided as a function.
23
23
  */
24
- spec: Value<Promisable<OpenAPIDocument>, [StandardHandlerRoutingInterceptorOptions<T>]>;
24
+ spec: Value<Promisable<OpenAPIDocument<OpenAPIVersion>>, [StandardHandlerRoutingInterceptorOptions<T>]>;
25
25
  /**
26
26
  * Determines whether the docs UI and OpenAPI JSON are allowed to be served for a request.
27
27
  * When it resolves to `false`, the request falls through as unmatched,
@@ -2,10 +2,10 @@ import { Context } from '@orpc/server';
2
2
  import { StandardHandlerPlugin, StandardHandlerRoutingInterceptorOptions, StandardHandlerOptions } from '@orpc/server/standard';
3
3
  import { Value, Promisable } from '@orpc/shared';
4
4
  import { ApiReferenceConfiguration } from '@scalar/api-reference';
5
- import { StandardUrl } from '@standardserver/core';
5
+ import { StandardUrl } from '@standard-server/core';
6
6
  import { SwaggerUIOptions } from 'swagger-ui';
7
- import { OpenAPIDocument } from '../index.js';
8
- import '@hey-api/spec-types';
7
+ import { OpenAPIDocument, OpenAPIVersion } from '../index.js';
8
+ import '@openapi-spec/types';
9
9
  import '@orpc/client';
10
10
 
11
11
  type OpenAPIReferenceHandlerPluginProvider = 'scalar' | 'swagger';
@@ -21,7 +21,7 @@ interface OpenAPIReferenceHandlerPluginOptions<T extends Context, TProvider exte
21
21
  * A static or dynamic OpenAPI document to serve.
22
22
  * Receives routing interceptor options when provided as a function.
23
23
  */
24
- spec: Value<Promisable<OpenAPIDocument>, [StandardHandlerRoutingInterceptorOptions<T>]>;
24
+ spec: Value<Promisable<OpenAPIDocument<OpenAPIVersion>>, [StandardHandlerRoutingInterceptorOptions<T>]>;
25
25
  /**
26
26
  * Determines whether the docs UI and OpenAPI JSON are allowed to be served for a request.
27
27
  * When it resolves to `false`, the request falls through as unmatched,
@@ -2,11 +2,11 @@ import { createORPCErrorFromMalformedResponse, isORPCErrorJson, createORPCErrorF
2
2
  import { getRouterContract, ProcedureContract } from '@orpc/contract';
3
3
  import { unlazy } from '@orpc/server';
4
4
  import { value, pathToHttpPath, mergeHttpPath, isTypescriptObject, stringifyJSON } from '@orpc/shared';
5
- import { mergeStandardHeaders, parseStandardUrl } from '@standardserver/core';
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, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.0yE-t1W-.mjs';
5
+ import { mergeStandardHeaders, parseStandardUrl } from '@standard-server/core';
6
+ import { toStandardHeaders } from '@standard-server/fetch';
7
+ import { O as OpenAPISerializer, D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, g as getDynamicPathParams, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.Cz2PauNH.mjs';
8
8
  import { g as getOpenAPIMeta } from './openapi.B9PQzqBn.mjs';
9
- import { s as serializeHeaders } from './openapi.BITX91Fj.mjs';
9
+ import { s as serializeHeaders } from './openapi.Dxn8HAW0.mjs';
10
10
 
11
11
  const END_SLASH_REGEX = /\/$/;
12
12
  class OpenAPILinkCodec {
@@ -2,9 +2,9 @@ import { AnyORPCError } from '@orpc/client';
2
2
  import { AnyProcedure, AnyRouter, Context } from '@orpc/server';
3
3
  import { StandardHandlerCodec, StandardHandlerHandleOptions, StandardHandlerCodecResolvedProcedure } from '@orpc/server/standard';
4
4
  import { Value, Promisable } from '@orpc/shared';
5
- import { StandardLazyRequest, StandardResponse } from '@standardserver/core';
5
+ import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
6
6
  import { AnyProcedureContract } from '@orpc/contract';
7
- import { O as OpenAPISerializer } from './openapi.Dz-JaXHo.mjs';
7
+ import { O as OpenAPISerializer } from './openapi.DXWj9fY8.js';
8
8
 
9
9
  interface OpenAPIMatcherOptions {
10
10
  /**
@@ -2,8 +2,8 @@ import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
2
2
  import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
3
3
  import { RouterContract } from '@orpc/contract';
4
4
  import { Value, Promisable } from '@orpc/shared';
5
- import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standardserver/core';
6
- import { O as OpenAPISerializer } from './openapi.Dz-JaXHo.mjs';
5
+ import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standard-server/core';
6
+ import { O as OpenAPISerializer } from './openapi.DXWj9fY8.mjs';
7
7
 
8
8
  interface OpenAPILinkCodecOptions<T extends ClientContext> {
9
9
  /**
@@ -2,8 +2,8 @@ import { ClientContext, ClientOptions, AnyORPCError } from '@orpc/client';
2
2
  import { StandardLinkCodec, StandardLinkCodecDecodedResponse } from '@orpc/client/standard';
3
3
  import { RouterContract } from '@orpc/contract';
4
4
  import { Value, Promisable } from '@orpc/shared';
5
- import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standardserver/core';
6
- import { O as OpenAPISerializer } from './openapi.Dz-JaXHo.js';
5
+ import { StandardUrl, StandardHeaders, StandardLazyResponse, StandardRequest } from '@standard-server/core';
6
+ import { O as OpenAPISerializer } from './openapi.DXWj9fY8.js';
7
7
 
8
8
  interface OpenAPILinkCodecOptions<T extends ClientContext> {
9
9
  /**
@@ -2,9 +2,9 @@ import { AnyORPCError } from '@orpc/client';
2
2
  import { AnyProcedure, AnyRouter, Context } from '@orpc/server';
3
3
  import { StandardHandlerCodec, StandardHandlerHandleOptions, StandardHandlerCodecResolvedProcedure } from '@orpc/server/standard';
4
4
  import { Value, Promisable } from '@orpc/shared';
5
- import { StandardLazyRequest, StandardResponse } from '@standardserver/core';
5
+ import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
6
6
  import { AnyProcedureContract } from '@orpc/contract';
7
- import { O as OpenAPISerializer } from './openapi.Dz-JaXHo.js';
7
+ import { O as OpenAPISerializer } from './openapi.DXWj9fY8.mjs';
8
8
 
9
9
  interface OpenAPIMatcherOptions {
10
10
  /**
@@ -1,20 +1,19 @@
1
- import { OpenAPIV3_1 } from '@hey-api/spec-types';
1
+ import { OpenAPIV3_0, OpenAPIV3_1, OpenAPIV3_2 } from '@openapi-spec/types';
2
2
  import { AnyNestedClient, Client, ORPCError } from '@orpc/client';
3
3
  import { AsyncIteratorClass } from '@orpc/shared';
4
4
 
5
- type OpenAPIOperationObject = OpenAPIV3_1.OperationObject;
6
5
  /**
7
- * An OpenAPI 3.1 document with the OpenAPI 3.2 QUERY additions used by oRPC.
8
- * This type does not claim support for the complete OpenAPI 3.2 specification.
6
+ * An OpenAPI version `OpenAPIGenerator` can target: any `3.0.x`, `3.1.x`, or `3.2.x` value.
7
+ *
8
+ * @see {@link https://orpc.dev/docs/openapi/specification#openapi-version | OpenAPI Specification - OpenAPI Version}
9
9
  */
10
- type OpenAPIDocument = Omit<OpenAPIV3_1.Document, 'openapi' | 'paths'> & {
11
- openapi: OpenAPIV3_1.Document['openapi'] | '3.2.0';
12
- paths?: undefined | (OpenAPIV3_1.PathsObject & {
13
- [path: `/${string}`]: OpenAPIV3_1.PathItemObject & {
14
- query?: OpenAPIOperationObject | undefined;
15
- };
16
- });
17
- };
10
+ type OpenAPIVersion = `3.0.${number}` | `3.1.${number}` | `3.2.${number}`;
11
+ /**
12
+ * The OpenAPI document of the given version.
13
+ *
14
+ * @see {@link https://orpc.dev/docs/openapi/specification#openapi-version | OpenAPI Specification - OpenAPI Version}
15
+ */
16
+ type OpenAPIDocument<TVersion extends OpenAPIVersion> = TVersion extends `3.0.${string}` ? OpenAPIV3_0.OpenAPIObject : TVersion extends `3.1.${string}` ? OpenAPIV3_1.OpenAPIObject : OpenAPIV3_2.OpenAPIObject;
18
17
  type JsonifiedValue<T> = T extends string ? T : T extends number ? T : T extends boolean ? T : T extends null ? T : T extends undefined ? T : T extends Array<unknown> ? JsonifiedArray<T> : T extends Record<string, unknown> ? {
19
18
  [K in keyof T]: JsonifiedValue<T[K]>;
20
19
  } : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : T extends RegExp ? string : T extends URL ? string : T extends Map<infer K, infer V> ? JsonifiedArray<[K, V][]> : T extends Set<infer U> ? JsonifiedArray<U[]> : T extends AsyncIteratorClass<infer U, infer V> ? AsyncIteratorClass<JsonifiedValue<U>, JsonifiedValue<V>> : T extends AsyncGenerator<infer U, infer V> ? AsyncGenerator<JsonifiedValue<U>, JsonifiedValue<V>> : T extends AsyncIteratorObject<infer U, infer V> ? AsyncIteratorObject<JsonifiedValue<U>, JsonifiedValue<V>> : unknown;
@@ -29,4 +28,4 @@ type JsonifiedClient<T extends AnyNestedClient> = T extends Client<infer UClient
29
28
  [K in keyof T]: T[K] extends AnyNestedClient ? JsonifiedClient<T[K]> : T[K];
30
29
  };
31
30
 
32
- export type { JsonifiedClient as J, OpenAPIDocument as O, JsonifiedArray as a, JsonifiedClientError as b, JsonifiedValue as c, OpenAPIOperationObject as d };
31
+ export type { JsonifiedClient as J, OpenAPIVersion as O, OpenAPIDocument as a, JsonifiedArray as b, JsonifiedClientError as c, JsonifiedValue as d };
@@ -1,20 +1,19 @@
1
- import { OpenAPIV3_1 } from '@hey-api/spec-types';
1
+ import { OpenAPIV3_0, OpenAPIV3_1, OpenAPIV3_2 } from '@openapi-spec/types';
2
2
  import { AnyNestedClient, Client, ORPCError } from '@orpc/client';
3
3
  import { AsyncIteratorClass } from '@orpc/shared';
4
4
 
5
- type OpenAPIOperationObject = OpenAPIV3_1.OperationObject;
6
5
  /**
7
- * An OpenAPI 3.1 document with the OpenAPI 3.2 QUERY additions used by oRPC.
8
- * This type does not claim support for the complete OpenAPI 3.2 specification.
6
+ * An OpenAPI version `OpenAPIGenerator` can target: any `3.0.x`, `3.1.x`, or `3.2.x` value.
7
+ *
8
+ * @see {@link https://orpc.dev/docs/openapi/specification#openapi-version | OpenAPI Specification - OpenAPI Version}
9
9
  */
10
- type OpenAPIDocument = Omit<OpenAPIV3_1.Document, 'openapi' | 'paths'> & {
11
- openapi: OpenAPIV3_1.Document['openapi'] | '3.2.0';
12
- paths?: undefined | (OpenAPIV3_1.PathsObject & {
13
- [path: `/${string}`]: OpenAPIV3_1.PathItemObject & {
14
- query?: OpenAPIOperationObject | undefined;
15
- };
16
- });
17
- };
10
+ type OpenAPIVersion = `3.0.${number}` | `3.1.${number}` | `3.2.${number}`;
11
+ /**
12
+ * The OpenAPI document of the given version.
13
+ *
14
+ * @see {@link https://orpc.dev/docs/openapi/specification#openapi-version | OpenAPI Specification - OpenAPI Version}
15
+ */
16
+ type OpenAPIDocument<TVersion extends OpenAPIVersion> = TVersion extends `3.0.${string}` ? OpenAPIV3_0.OpenAPIObject : TVersion extends `3.1.${string}` ? OpenAPIV3_1.OpenAPIObject : OpenAPIV3_2.OpenAPIObject;
18
17
  type JsonifiedValue<T> = T extends string ? T : T extends number ? T : T extends boolean ? T : T extends null ? T : T extends undefined ? T : T extends Array<unknown> ? JsonifiedArray<T> : T extends Record<string, unknown> ? {
19
18
  [K in keyof T]: JsonifiedValue<T[K]>;
20
19
  } : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : T extends RegExp ? string : T extends URL ? string : T extends Map<infer K, infer V> ? JsonifiedArray<[K, V][]> : T extends Set<infer U> ? JsonifiedArray<U[]> : T extends AsyncIteratorClass<infer U, infer V> ? AsyncIteratorClass<JsonifiedValue<U>, JsonifiedValue<V>> : T extends AsyncGenerator<infer U, infer V> ? AsyncGenerator<JsonifiedValue<U>, JsonifiedValue<V>> : T extends AsyncIteratorObject<infer U, infer V> ? AsyncIteratorObject<JsonifiedValue<U>, JsonifiedValue<V>> : unknown;
@@ -29,4 +28,4 @@ type JsonifiedClient<T extends AnyNestedClient> = T extends Client<infer UClient
29
28
  [K in keyof T]: T[K] extends AnyNestedClient ? JsonifiedClient<T[K]> : T[K];
30
29
  };
31
30
 
32
- export type { JsonifiedClient as J, OpenAPIDocument as O, JsonifiedArray as a, JsonifiedClientError as b, JsonifiedValue as c, OpenAPIOperationObject as d };
31
+ export type { JsonifiedClient as J, OpenAPIVersion as O, OpenAPIDocument as a, JsonifiedArray as b, JsonifiedClientError as c, JsonifiedValue as d };
@@ -1,8 +1,8 @@
1
1
  import { AnySchema, ErrorMap, MetaPlugin, AnyProcedureContract } from '@orpc/contract';
2
2
  import { Lazy } from '@orpc/server';
3
3
  import { Value } from '@orpc/shared';
4
- import { StandardBodyHint } from '@standardserver/core';
5
- import { d as OpenAPIOperationObject } from './openapi.DfTTLtn5.mjs';
4
+ import { StandardBodyHint } from '@standard-server/core';
5
+ import { OpenAPIV3_2 } from '@openapi-spec/types';
6
6
 
7
7
  interface OpenAPIMeta {
8
8
  /**
@@ -267,6 +267,9 @@ interface OpenAPIMeta {
267
267
  * Pass a plain object to replace entire operation object, or a function that receives the current
268
268
  * operation object and returns the modified version.
269
269
  *
270
+ * The operation object always follows OpenAPI 3.2, `OpenAPIGenerator` downgrades it with the
271
+ * rest of the document when an older version is requested.
272
+ *
270
273
  * **Merging**: When defined multiple times:
271
274
  *
272
275
  * - Two functions are chained: the most recent function receives the result of the previous one.
@@ -275,7 +278,7 @@ interface OpenAPIMeta {
275
278
  *
276
279
  * Explicitly setting `undefined` resets the spec instead of merging.
277
280
  */
278
- spec?: Value<OpenAPIOperationObject, [current: OpenAPIOperationObject]>;
281
+ spec?: Value<OpenAPIV3_2.OperationObject, [current: OpenAPIV3_2.OperationObject]>;
279
282
  /**
280
283
  * Prefix for the path. Useful when you want to apply a common path prefix across multiple procedures.
281
284
  *
@@ -1,8 +1,8 @@
1
1
  import { AnySchema, ErrorMap, MetaPlugin, AnyProcedureContract } from '@orpc/contract';
2
2
  import { Lazy } from '@orpc/server';
3
3
  import { Value } from '@orpc/shared';
4
- import { StandardBodyHint } from '@standardserver/core';
5
- import { d as OpenAPIOperationObject } from './openapi.DfTTLtn5.js';
4
+ import { StandardBodyHint } from '@standard-server/core';
5
+ import { OpenAPIV3_2 } from '@openapi-spec/types';
6
6
 
7
7
  interface OpenAPIMeta {
8
8
  /**
@@ -267,6 +267,9 @@ interface OpenAPIMeta {
267
267
  * Pass a plain object to replace entire operation object, or a function that receives the current
268
268
  * operation object and returns the modified version.
269
269
  *
270
+ * The operation object always follows OpenAPI 3.2, `OpenAPIGenerator` downgrades it with the
271
+ * rest of the document when an older version is requested.
272
+ *
270
273
  * **Merging**: When defined multiple times:
271
274
  *
272
275
  * - Two functions are chained: the most recent function receives the result of the previous one.
@@ -275,7 +278,7 @@ interface OpenAPIMeta {
275
278
  *
276
279
  * Explicitly setting `undefined` resets the spec instead of merging.
277
280
  */
278
- spec?: Value<OpenAPIOperationObject, [current: OpenAPIOperationObject]>;
281
+ spec?: Value<OpenAPIV3_2.OperationObject, [current: OpenAPIV3_2.OperationObject]>;
279
282
  /**
280
283
  * Prefix for the path. Useful when you want to apply a common path prefix across multiple procedures.
281
284
  *
@@ -1,6 +1,6 @@
1
1
  import { wrapAsyncIteratorPreservingEventMeta, toORPCError, isORPCErrorJson, createORPCErrorFromJson } from '@orpc/client';
2
2
  import { isPlainObject, NullProtoObj, isAsyncIteratorObject } from '@orpc/shared';
3
- import { ErrorEvent } from '@standardserver/core';
3
+ import { ErrorEvent } from '@standard-server/core';
4
4
  import { B as BracketNotationSerializer } from './openapi.s_p5sN-P.mjs';
5
5
 
6
6
  const DEFAULT_OPENAPI_METHOD = "POST";
@@ -1,4 +1,4 @@
1
- import { StandardBody } from '@standardserver/core';
1
+ import { StandardBody } from '@standard-server/core';
2
2
  import { Segment } from '@orpc/shared';
3
3
 
4
4
  type BracketNotationSerializeResult = [string, unknown][];
@@ -1,4 +1,4 @@
1
- import { StandardBody } from '@standardserver/core';
1
+ import { StandardBody } from '@standard-server/core';
2
2
  import { Segment } from '@orpc/shared';
3
3
 
4
4
  type BracketNotationSerializeResult = [string, unknown][];
@@ -1,8 +1,8 @@
1
1
  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, NullProtoObj, isTypescriptObject, isPlainObject, stringifyJSON, getOwn, parseEmptyableJSON } from '@orpc/shared';
4
- import { parseStandardUrl } from '@standardserver/core';
5
- import { D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, O as OpenAPISerializer, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.0yE-t1W-.mjs';
4
+ import { parseStandardUrl } from '@standard-server/core';
5
+ import { D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, O as OpenAPISerializer, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.Cz2PauNH.mjs';
6
6
  import { g as getOpenAPIMeta } from './openapi.B9PQzqBn.mjs';
7
7
  import { createRouter, addRoute, findRoute, routeToRegExp } from 'rou3';
8
8
 
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.33",
4
+ "version": "2.0.0-beta.34",
5
5
  "description": "Generate OpenAPI specs from oRPC routers and serve OpenAPI-compliant APIs with end-to-end type safety",
6
6
  "license": "MIT",
7
7
  "funding": [
@@ -97,19 +97,20 @@
97
97
  }
98
98
  },
99
99
  "dependencies": {
100
- "@hey-api/spec-types": "0.0.0-next-20260408030107",
101
- "@orpc/client": "2.0.0-beta.33",
102
- "@orpc/contract": "2.0.0-beta.33",
103
- "@orpc/json-schema": "2.0.0-beta.33",
104
- "@orpc/server": "2.0.0-beta.33",
105
- "@orpc/shared": "2.0.0-beta.33",
106
- "@standardserver/core": "^0.8.3",
107
- "@standardserver/fetch": "^0.8.3",
100
+ "@openapi-spec/downgrader": "~0.1.0",
101
+ "@openapi-spec/types": "~0.1.0",
102
+ "@orpc/client": "2.0.0-beta.34",
103
+ "@orpc/contract": "2.0.0-beta.34",
104
+ "@orpc/json-schema": "2.0.0-beta.34",
105
+ "@orpc/server": "2.0.0-beta.34",
106
+ "@orpc/shared": "2.0.0-beta.34",
107
+ "@standard-server/core": "~0.9.0",
108
+ "@standard-server/fetch": "~0.9.0",
108
109
  "rou3": "^0.9.1"
109
110
  },
110
111
  "devDependencies": {
111
112
  "@scalar/api-reference": "^1.65.1",
112
- "@standardserver/aws-lambda": "^0.8.3",
113
+ "@standard-server/aws-lambda": "~0.9.0",
113
114
  "@types/swagger-ui": "^5.32.0",
114
115
  "fastify": "^5.12.1",
115
116
  "swagger-ui": "^5.32.14",