@orpc/json-schema 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.
- package/dist/index.d.mts +42 -5
- package/dist/index.d.ts +42 -5
- package/dist/index.mjs +33 -2
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { Format as JsonSchemaFormat, TypeName as JsonSchemaType } from 'json-schema-typed/draft-2020-12';
|
|
1
|
+
import { OpenAPIV3_2 } from '@openapi-spec/types';
|
|
3
2
|
import { AnySchema, RouterContract } from '@orpc/contract';
|
|
4
3
|
export { AnySchema, Schema } from '@orpc/contract';
|
|
5
4
|
import { Context } from '@orpc/server';
|
|
@@ -11,10 +10,48 @@ import { StandardJSONSchemaV1 } from '@standard-schema/spec';
|
|
|
11
10
|
/**
|
|
12
11
|
* A JSON Schema (draft 2020-12) representation used across oRPC's JSON schema tooling.
|
|
13
12
|
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* It is also the OpenAPI 3.2 Schema Object, so converted schemas embed into OpenAPI documents as-is.
|
|
15
|
+
*
|
|
14
16
|
* @see {@link https://orpc.dev/docs/integrations/standard-schema | Standard Schema Integration}
|
|
15
17
|
*/
|
|
16
|
-
type JsonSchema<Value = any> =
|
|
17
|
-
|
|
18
|
+
type JsonSchema<Value = any> = OpenAPIV3_2.SchemaObject<Value>;
|
|
19
|
+
/**
|
|
20
|
+
* The declared JSON Schema keywords, the index signature is filtered out.
|
|
21
|
+
*/
|
|
22
|
+
type JsonSchemaKeywords = keyof {
|
|
23
|
+
[K in keyof OpenAPIV3_2.SchemaObjectFields as string extends K ? never : K]: unknown;
|
|
24
|
+
};
|
|
25
|
+
declare enum JsonSchemaType {
|
|
26
|
+
Array = "array",
|
|
27
|
+
Boolean = "boolean",
|
|
28
|
+
Integer = "integer",
|
|
29
|
+
Null = "null",
|
|
30
|
+
Number = "number",
|
|
31
|
+
Object = "object",
|
|
32
|
+
String = "string"
|
|
33
|
+
}
|
|
34
|
+
declare enum JsonSchemaFormat {
|
|
35
|
+
Date = "date",
|
|
36
|
+
DateTime = "date-time",
|
|
37
|
+
Duration = "duration",
|
|
38
|
+
Email = "email",
|
|
39
|
+
Hostname = "hostname",
|
|
40
|
+
IDNEmail = "idn-email",
|
|
41
|
+
IDNHostname = "idn-hostname",
|
|
42
|
+
IPv4 = "ipv4",
|
|
43
|
+
IPv6 = "ipv6",
|
|
44
|
+
IRI = "iri",
|
|
45
|
+
IRIReference = "iri-reference",
|
|
46
|
+
JSONPointer = "json-pointer",
|
|
47
|
+
RegEx = "regex",
|
|
48
|
+
RelativeJSONPointer = "relative-json-pointer",
|
|
49
|
+
Time = "time",
|
|
50
|
+
URI = "uri",
|
|
51
|
+
URIReference = "uri-reference",
|
|
52
|
+
URITemplate = "uri-template",
|
|
53
|
+
UUID = "uuid"
|
|
54
|
+
}
|
|
18
55
|
declare enum JsonSchemaXNativeType {
|
|
19
56
|
BigInt = "bigint",
|
|
20
57
|
RegExp = "regexp",
|
|
@@ -215,5 +252,5 @@ declare class StandardJsonSchemaConverter implements JsonSchemaConverter {
|
|
|
215
252
|
convertInternal(schema: StandardJSONSchemaV1 & AnySchema, direction: JsonSchemaConverterDirection): [jsonSchema: JsonSchema, optional: boolean];
|
|
216
253
|
}
|
|
217
254
|
|
|
218
|
-
export { DelegatingJsonSchemaConverter, JsonSchemaCoercer, JsonSchemaXNativeType, SmartCoercionHandlerPlugin, SmartCoercionLinkPlugin, StandardJsonSchemaConverter, combineJsonObjectSchemaEntries, combineJsonSchemasWithComposition, decodeJsonPointerSegment, deduplicateJsonSchemas, encodeJsonPointerSegment, ensureJsonSchemaObject, extractJsonObjectSchemaEntries, flattenJsonUnionSchema, hoistRecursiveRefToDef, isJsonArraySchema, isJsonFileSchema, isJsonObjectSchema, isJsonPrimitiveSchema, isUnconstrainedSchema, mapJsonSchemaRefs, matchArrayableJsonSchema, resolveJsonSchemaRootLocalRef, visitJsonSchemaRefs };
|
|
255
|
+
export { DelegatingJsonSchemaConverter, JsonSchemaCoercer, JsonSchemaFormat, JsonSchemaType, JsonSchemaXNativeType, SmartCoercionHandlerPlugin, SmartCoercionLinkPlugin, StandardJsonSchemaConverter, combineJsonObjectSchemaEntries, combineJsonSchemasWithComposition, decodeJsonPointerSegment, deduplicateJsonSchemas, encodeJsonPointerSegment, ensureJsonSchemaObject, extractJsonObjectSchemaEntries, flattenJsonUnionSchema, hoistRecursiveRefToDef, isJsonArraySchema, isJsonFileSchema, isJsonObjectSchema, isJsonPrimitiveSchema, isUnconstrainedSchema, mapJsonSchemaRefs, matchArrayableJsonSchema, resolveJsonSchemaRootLocalRef, visitJsonSchemaRefs };
|
|
219
256
|
export type { JsonArraySchema, JsonFileSchema, JsonObjectSchema, JsonObjectSchemaEntry, JsonSchema, JsonSchemaConverter, JsonSchemaConverterDirection, JsonSchemaKeywords, SmartCoercionHandlerPluginOptions, SmartCoercionLinkPluginOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { Format as JsonSchemaFormat, TypeName as JsonSchemaType } from 'json-schema-typed/draft-2020-12';
|
|
1
|
+
import { OpenAPIV3_2 } from '@openapi-spec/types';
|
|
3
2
|
import { AnySchema, RouterContract } from '@orpc/contract';
|
|
4
3
|
export { AnySchema, Schema } from '@orpc/contract';
|
|
5
4
|
import { Context } from '@orpc/server';
|
|
@@ -11,10 +10,48 @@ import { StandardJSONSchemaV1 } from '@standard-schema/spec';
|
|
|
11
10
|
/**
|
|
12
11
|
* A JSON Schema (draft 2020-12) representation used across oRPC's JSON schema tooling.
|
|
13
12
|
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* It is also the OpenAPI 3.2 Schema Object, so converted schemas embed into OpenAPI documents as-is.
|
|
15
|
+
*
|
|
14
16
|
* @see {@link https://orpc.dev/docs/integrations/standard-schema | Standard Schema Integration}
|
|
15
17
|
*/
|
|
16
|
-
type JsonSchema<Value = any> =
|
|
17
|
-
|
|
18
|
+
type JsonSchema<Value = any> = OpenAPIV3_2.SchemaObject<Value>;
|
|
19
|
+
/**
|
|
20
|
+
* The declared JSON Schema keywords, the index signature is filtered out.
|
|
21
|
+
*/
|
|
22
|
+
type JsonSchemaKeywords = keyof {
|
|
23
|
+
[K in keyof OpenAPIV3_2.SchemaObjectFields as string extends K ? never : K]: unknown;
|
|
24
|
+
};
|
|
25
|
+
declare enum JsonSchemaType {
|
|
26
|
+
Array = "array",
|
|
27
|
+
Boolean = "boolean",
|
|
28
|
+
Integer = "integer",
|
|
29
|
+
Null = "null",
|
|
30
|
+
Number = "number",
|
|
31
|
+
Object = "object",
|
|
32
|
+
String = "string"
|
|
33
|
+
}
|
|
34
|
+
declare enum JsonSchemaFormat {
|
|
35
|
+
Date = "date",
|
|
36
|
+
DateTime = "date-time",
|
|
37
|
+
Duration = "duration",
|
|
38
|
+
Email = "email",
|
|
39
|
+
Hostname = "hostname",
|
|
40
|
+
IDNEmail = "idn-email",
|
|
41
|
+
IDNHostname = "idn-hostname",
|
|
42
|
+
IPv4 = "ipv4",
|
|
43
|
+
IPv6 = "ipv6",
|
|
44
|
+
IRI = "iri",
|
|
45
|
+
IRIReference = "iri-reference",
|
|
46
|
+
JSONPointer = "json-pointer",
|
|
47
|
+
RegEx = "regex",
|
|
48
|
+
RelativeJSONPointer = "relative-json-pointer",
|
|
49
|
+
Time = "time",
|
|
50
|
+
URI = "uri",
|
|
51
|
+
URIReference = "uri-reference",
|
|
52
|
+
URITemplate = "uri-template",
|
|
53
|
+
UUID = "uuid"
|
|
54
|
+
}
|
|
18
55
|
declare enum JsonSchemaXNativeType {
|
|
19
56
|
BigInt = "bigint",
|
|
20
57
|
RegExp = "regexp",
|
|
@@ -215,5 +252,5 @@ declare class StandardJsonSchemaConverter implements JsonSchemaConverter {
|
|
|
215
252
|
convertInternal(schema: StandardJSONSchemaV1 & AnySchema, direction: JsonSchemaConverterDirection): [jsonSchema: JsonSchema, optional: boolean];
|
|
216
253
|
}
|
|
217
254
|
|
|
218
|
-
export { DelegatingJsonSchemaConverter, JsonSchemaCoercer, JsonSchemaXNativeType, SmartCoercionHandlerPlugin, SmartCoercionLinkPlugin, StandardJsonSchemaConverter, combineJsonObjectSchemaEntries, combineJsonSchemasWithComposition, decodeJsonPointerSegment, deduplicateJsonSchemas, encodeJsonPointerSegment, ensureJsonSchemaObject, extractJsonObjectSchemaEntries, flattenJsonUnionSchema, hoistRecursiveRefToDef, isJsonArraySchema, isJsonFileSchema, isJsonObjectSchema, isJsonPrimitiveSchema, isUnconstrainedSchema, mapJsonSchemaRefs, matchArrayableJsonSchema, resolveJsonSchemaRootLocalRef, visitJsonSchemaRefs };
|
|
255
|
+
export { DelegatingJsonSchemaConverter, JsonSchemaCoercer, JsonSchemaFormat, JsonSchemaType, JsonSchemaXNativeType, SmartCoercionHandlerPlugin, SmartCoercionLinkPlugin, StandardJsonSchemaConverter, combineJsonObjectSchemaEntries, combineJsonSchemasWithComposition, decodeJsonPointerSegment, deduplicateJsonSchemas, encodeJsonPointerSegment, ensureJsonSchemaObject, extractJsonObjectSchemaEntries, flattenJsonUnionSchema, hoistRecursiveRefToDef, isJsonArraySchema, isJsonFileSchema, isJsonObjectSchema, isJsonPrimitiveSchema, isUnconstrainedSchema, mapJsonSchemaRefs, matchArrayableJsonSchema, resolveJsonSchemaRootLocalRef, visitJsonSchemaRefs };
|
|
219
256
|
export type { JsonArraySchema, JsonFileSchema, JsonObjectSchema, JsonObjectSchemaEntry, JsonSchema, JsonSchemaConverter, JsonSchemaConverterDirection, JsonSchemaKeywords, SmartCoercionHandlerPluginOptions, SmartCoercionLinkPluginOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { get, isPlainObject, tryOrUndefined, toArray, isDeepEqual, omit, isTypescriptObject, getOwn } from '@orpc/shared';
|
|
2
|
-
export { Format as JsonSchemaFormat, TypeName as JsonSchemaType } from 'json-schema-typed/draft-2020-12';
|
|
3
2
|
import { ORPCError, cloneORPCError } from '@orpc/client';
|
|
4
3
|
import { getProcedureContractOrThrow } from '@orpc/contract';
|
|
5
4
|
|
|
@@ -159,6 +158,38 @@ function findRecursiveJsonSchemaDefName(defs) {
|
|
|
159
158
|
return `__schema${index}`;
|
|
160
159
|
}
|
|
161
160
|
|
|
161
|
+
var JsonSchemaType = /* @__PURE__ */ ((JsonSchemaType2) => {
|
|
162
|
+
JsonSchemaType2["Array"] = "array";
|
|
163
|
+
JsonSchemaType2["Boolean"] = "boolean";
|
|
164
|
+
JsonSchemaType2["Integer"] = "integer";
|
|
165
|
+
JsonSchemaType2["Null"] = "null";
|
|
166
|
+
JsonSchemaType2["Number"] = "number";
|
|
167
|
+
JsonSchemaType2["Object"] = "object";
|
|
168
|
+
JsonSchemaType2["String"] = "string";
|
|
169
|
+
return JsonSchemaType2;
|
|
170
|
+
})(JsonSchemaType || {});
|
|
171
|
+
var JsonSchemaFormat = /* @__PURE__ */ ((JsonSchemaFormat2) => {
|
|
172
|
+
JsonSchemaFormat2["Date"] = "date";
|
|
173
|
+
JsonSchemaFormat2["DateTime"] = "date-time";
|
|
174
|
+
JsonSchemaFormat2["Duration"] = "duration";
|
|
175
|
+
JsonSchemaFormat2["Email"] = "email";
|
|
176
|
+
JsonSchemaFormat2["Hostname"] = "hostname";
|
|
177
|
+
JsonSchemaFormat2["IDNEmail"] = "idn-email";
|
|
178
|
+
JsonSchemaFormat2["IDNHostname"] = "idn-hostname";
|
|
179
|
+
JsonSchemaFormat2["IPv4"] = "ipv4";
|
|
180
|
+
JsonSchemaFormat2["IPv6"] = "ipv6";
|
|
181
|
+
JsonSchemaFormat2["IRI"] = "iri";
|
|
182
|
+
JsonSchemaFormat2["IRIReference"] = "iri-reference";
|
|
183
|
+
JsonSchemaFormat2["JSONPointer"] = "json-pointer";
|
|
184
|
+
JsonSchemaFormat2["RegEx"] = "regex";
|
|
185
|
+
JsonSchemaFormat2["RelativeJSONPointer"] = "relative-json-pointer";
|
|
186
|
+
JsonSchemaFormat2["Time"] = "time";
|
|
187
|
+
JsonSchemaFormat2["URI"] = "uri";
|
|
188
|
+
JsonSchemaFormat2["URIReference"] = "uri-reference";
|
|
189
|
+
JsonSchemaFormat2["URITemplate"] = "uri-template";
|
|
190
|
+
JsonSchemaFormat2["UUID"] = "uuid";
|
|
191
|
+
return JsonSchemaFormat2;
|
|
192
|
+
})(JsonSchemaFormat || {});
|
|
162
193
|
var JsonSchemaXNativeType = /* @__PURE__ */ ((JsonSchemaXNativeType2) => {
|
|
163
194
|
JsonSchemaXNativeType2["BigInt"] = "bigint";
|
|
164
195
|
JsonSchemaXNativeType2["RegExp"] = "regexp";
|
|
@@ -984,4 +1015,4 @@ class SmartCoercionLinkPlugin {
|
|
|
984
1015
|
}
|
|
985
1016
|
}
|
|
986
1017
|
|
|
987
|
-
export { DelegatingJsonSchemaConverter, JsonSchemaCoercer, JsonSchemaXNativeType, SmartCoercionHandlerPlugin, SmartCoercionLinkPlugin, StandardJsonSchemaConverter, combineJsonObjectSchemaEntries, combineJsonSchemasWithComposition, decodeJsonPointerSegment, deduplicateJsonSchemas, encodeJsonPointerSegment, ensureJsonSchemaObject, extractJsonObjectSchemaEntries, flattenJsonUnionSchema, hoistRecursiveRefToDef, isJsonArraySchema, isJsonFileSchema, isJsonObjectSchema, isJsonPrimitiveSchema, isUnconstrainedSchema, mapJsonSchemaRefs, matchArrayableJsonSchema, resolveJsonSchemaRootLocalRef, visitJsonSchemaRefs };
|
|
1018
|
+
export { DelegatingJsonSchemaConverter, JsonSchemaCoercer, JsonSchemaFormat, JsonSchemaType, JsonSchemaXNativeType, SmartCoercionHandlerPlugin, SmartCoercionLinkPlugin, StandardJsonSchemaConverter, combineJsonObjectSchemaEntries, combineJsonSchemasWithComposition, decodeJsonPointerSegment, deduplicateJsonSchemas, encodeJsonPointerSegment, ensureJsonSchemaObject, extractJsonObjectSchemaEntries, flattenJsonUnionSchema, hoistRecursiveRefToDef, isJsonArraySchema, isJsonFileSchema, isJsonObjectSchema, isJsonPrimitiveSchema, isUnconstrainedSchema, mapJsonSchemaRefs, matchArrayableJsonSchema, resolveJsonSchemaRootLocalRef, visitJsonSchemaRefs };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/json-schema",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.34",
|
|
5
5
|
"description": "JSON Schema conversion and smart request coercion for oRPC and OpenAPI",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": [
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"dist"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@orpc/
|
|
40
|
-
"@orpc/
|
|
41
|
-
"@orpc/
|
|
42
|
-
"@
|
|
43
|
-
"
|
|
38
|
+
"@openapi-spec/types": "~0.1.0",
|
|
39
|
+
"@orpc/client": "2.0.0-beta.34",
|
|
40
|
+
"@orpc/contract": "2.0.0-beta.34",
|
|
41
|
+
"@orpc/server": "2.0.0-beta.34",
|
|
42
|
+
"@orpc/shared": "2.0.0-beta.34",
|
|
43
|
+
"@standard-schema/spec": "^1.1.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"zod": "^4.5.4"
|