@orpc/json-schema 2.0.0-beta.2 → 2.0.0-beta.4
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 +8 -7
- package/dist/index.d.mts +1 -4
- package/dist/index.d.ts +1 -4
- package/dist/index.mjs +15 -17
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -37,18 +37,19 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
37
37
|
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): Integrate with [Valibot](https://valibot.dev/).
|
|
38
38
|
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): Integrate with [ArkType](https://arktype.io/).
|
|
39
39
|
|
|
40
|
-
**Framework & ecosystem integrations**
|
|
41
|
-
|
|
42
|
-
- [@orpc/next](https://www.npmjs.com/package/@orpc/react): Use oRPC with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
|
|
43
|
-
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
44
|
-
- [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
|
|
45
|
-
|
|
46
40
|
**Built-in features**
|
|
47
41
|
|
|
48
42
|
- [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher): Pub/Sub.
|
|
49
43
|
- [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit): Rate limiting.
|
|
50
44
|
- [@orpc/json-schema](https://www.npmjs.com/package/@orpc/json-schema): Smart coercion for OpenAPI requests.
|
|
51
45
|
|
|
46
|
+
**Framework & ecosystem integrations**
|
|
47
|
+
|
|
48
|
+
- [@orpc/next](https://www.npmjs.com/package/@orpc/react): Use oRPC with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
|
|
49
|
+
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
50
|
+
- [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
|
|
51
|
+
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Implement your contract with [NestJS](https://nestjs.com/).
|
|
52
|
+
|
|
52
53
|
**Observability**
|
|
53
54
|
|
|
54
55
|
- [@orpc/opentelemetry](https://www.npmjs.com/package/@orpc/opentelemetry): Instrument your API with [OpenTelemetry](https://opentelemetry.io/).
|
|
@@ -150,7 +151,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
150
151
|
<a href="https://github.com/theoludwig?ref=orpc" target="_blank" rel="noopener" title="Théo LUDWIG"><img src="https://avatars.githubusercontent.com/u/25207499?u=a6a9653725a2f574c07893748806668e0598cdbe&v=4" width="32" height="32" alt="Théo LUDWIG" /></a>
|
|
151
152
|
<a href="https://github.com/abhay-ramesh?ref=orpc" target="_blank" rel="noopener" title="Abhay Ramesh"><img src="https://avatars.githubusercontent.com/u/66196314?u=c5c2b0327b26606c2efcfaf17046ab18c3d25c57&v=4" width="32" height="32" alt="Abhay Ramesh" /></a>
|
|
152
153
|
<a href="https://github.com/shr-ink?ref=orpc" target="_blank" rel="noopener" title="shr.ink oü"><img src="https://avatars.githubusercontent.com/u/139700438?v=4" width="32" height="32" alt="shr.ink oü" /></a>
|
|
153
|
-
<a href="https://github.com/johngerome?ref=orpc" target="_blank" rel="noopener" title="0x4e32"><img src="https://avatars.githubusercontent.com/u/2002000?u=
|
|
154
|
+
<a href="https://github.com/johngerome?ref=orpc" target="_blank" rel="noopener" title="0x4e32"><img src="https://avatars.githubusercontent.com/u/2002000?u=505e54608466ab53754f702973687b04c6424c1f&v=4" width="32" height="32" alt="0x4e32" /></a>
|
|
154
155
|
<a href="https://github.com/yzuyr?ref=orpc" target="_blank" rel="noopener" title="Ryuz"><img src="https://avatars.githubusercontent.com/u/196539378?u=d38374588d219b6748b16406982f6559411466d4&v=4" width="32" height="32" alt="Ryuz" /></a>
|
|
155
156
|
<a href="https://github.com/happyboy2022?ref=orpc" target="_blank" rel="noopener" title="happyboy"><img src="https://avatars.githubusercontent.com/u/103669586?u=65b49c4b893ed3703909fbb3a7a22313f3f9c121&v=4" width="32" height="32" alt="happyboy" /></a>
|
|
156
157
|
<a href="https://github.com/YiCChi?ref=orpc" target="_blank" rel="noopener" title="yicchi"><img src="https://avatars.githubusercontent.com/u/86967274?u=6c2756f09fe15dd94d572f560e979cd157982852&v=4" width="32" height="32" alt="yicchi" /></a>
|
package/dist/index.d.mts
CHANGED
|
@@ -30,6 +30,7 @@ declare class JsonSchemaCoercer {
|
|
|
30
30
|
* and exclusively use absolute JSON pointers for `$ref` values.
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
+
declare function isJsonPrimitiveSchema(schema: JsonSchema): schema is JsonSchema & object;
|
|
33
34
|
type JsonFileSchema = JsonSchema & object & {
|
|
34
35
|
type: 'string';
|
|
35
36
|
contentMediaType?: string;
|
|
@@ -70,10 +71,6 @@ declare function ensureJsonSchemaObject(schema: JsonSchema): Exclude<JsonSchema,
|
|
|
70
71
|
* Combines multiple schemas under the requested composition keyword, promoting branch `$defs` to the root.
|
|
71
72
|
*/
|
|
72
73
|
declare function combineJsonSchemasWithComposition(keyword: 'allOf' | 'anyOf' | 'oneOf', schemas: JsonSchema[]): JsonSchema;
|
|
73
|
-
/**
|
|
74
|
-
* Returns true when every branch in the schema describes a primitive value.
|
|
75
|
-
*/
|
|
76
|
-
declare function isJsonPrimitiveSchema(schema: JsonSchema): boolean;
|
|
77
74
|
type JsonObjectSchemaEntry = [name: string, schema: JsonSchema, optional: boolean];
|
|
78
75
|
/**
|
|
79
76
|
* Combines object property entries back into a single object schema.
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ declare class JsonSchemaCoercer {
|
|
|
30
30
|
* and exclusively use absolute JSON pointers for `$ref` values.
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
+
declare function isJsonPrimitiveSchema(schema: JsonSchema): schema is JsonSchema & object;
|
|
33
34
|
type JsonFileSchema = JsonSchema & object & {
|
|
34
35
|
type: 'string';
|
|
35
36
|
contentMediaType?: string;
|
|
@@ -70,10 +71,6 @@ declare function ensureJsonSchemaObject(schema: JsonSchema): Exclude<JsonSchema,
|
|
|
70
71
|
* Combines multiple schemas under the requested composition keyword, promoting branch `$defs` to the root.
|
|
71
72
|
*/
|
|
72
73
|
declare function combineJsonSchemasWithComposition(keyword: 'allOf' | 'anyOf' | 'oneOf', schemas: JsonSchema[]): JsonSchema;
|
|
73
|
-
/**
|
|
74
|
-
* Returns true when every branch in the schema describes a primitive value.
|
|
75
|
-
*/
|
|
76
|
-
declare function isJsonPrimitiveSchema(schema: JsonSchema): boolean;
|
|
77
74
|
type JsonObjectSchemaEntry = [name: string, schema: JsonSchema, optional: boolean];
|
|
78
75
|
/**
|
|
79
76
|
* Combines object property entries back into a single object schema.
|
package/dist/index.mjs
CHANGED
|
@@ -473,6 +473,21 @@ function arrayToMap(value) {
|
|
|
473
473
|
return result;
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
+
function isJsonPrimitiveSchema(schema) {
|
|
477
|
+
if (typeof schema === "boolean") {
|
|
478
|
+
return false;
|
|
479
|
+
}
|
|
480
|
+
if (typeof schema.type === "string" && JSON_SCHEMA_PRIMITIVE_TYPES.has(schema.type)) {
|
|
481
|
+
return true;
|
|
482
|
+
}
|
|
483
|
+
if (schema.const !== void 0) {
|
|
484
|
+
return true;
|
|
485
|
+
}
|
|
486
|
+
if (schema.enum !== void 0) {
|
|
487
|
+
return true;
|
|
488
|
+
}
|
|
489
|
+
return false;
|
|
490
|
+
}
|
|
476
491
|
function isJsonFileSchema(schema) {
|
|
477
492
|
return typeof schema !== "boolean" && schema.type === "string" && (typeof schema.contentMediaType === "string" || schema.format === "binary" || schema.contentEncoding === "binary");
|
|
478
493
|
}
|
|
@@ -568,23 +583,6 @@ function combineJsonSchemasWithComposition(keyword, schemas) {
|
|
|
568
583
|
}
|
|
569
584
|
return result;
|
|
570
585
|
}
|
|
571
|
-
function isJsonPrimitiveSchema(schema) {
|
|
572
|
-
return flattenJsonUnionSchema(schema).every((s) => {
|
|
573
|
-
if (typeof s === "boolean") {
|
|
574
|
-
return false;
|
|
575
|
-
}
|
|
576
|
-
if (typeof s.type === "string" && JSON_SCHEMA_PRIMITIVE_TYPES.has(s.type)) {
|
|
577
|
-
return true;
|
|
578
|
-
}
|
|
579
|
-
if (s.const !== void 0) {
|
|
580
|
-
return true;
|
|
581
|
-
}
|
|
582
|
-
if (s.enum !== void 0) {
|
|
583
|
-
return true;
|
|
584
|
-
}
|
|
585
|
-
return false;
|
|
586
|
-
});
|
|
587
|
-
}
|
|
588
586
|
function combineJsonObjectSchemaEntries(entries) {
|
|
589
587
|
const properties = {};
|
|
590
588
|
const required = [];
|
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.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@standard-schema/spec": "^1.1.0",
|
|
29
29
|
"json-schema-typed": "^8.0.2",
|
|
30
|
-
"@orpc/
|
|
31
|
-
"@orpc/contract": "2.0.0-beta.
|
|
32
|
-
"@orpc/
|
|
33
|
-
"@orpc/
|
|
30
|
+
"@orpc/client": "2.0.0-beta.4",
|
|
31
|
+
"@orpc/contract": "2.0.0-beta.4",
|
|
32
|
+
"@orpc/shared": "2.0.0-beta.4",
|
|
33
|
+
"@orpc/server": "2.0.0-beta.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"zod": "^4.4.3"
|