@orpc/zod 0.22.0 → 0.24.0
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.js +10 -0
- package/dist/src/converter.d.ts +6 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -528,6 +528,16 @@ function zodToJsonSchema(schema, options) {
|
|
528
528
|
return {};
|
529
529
|
}
|
530
530
|
const schema__ = schema;
|
531
|
+
if (!options?.isHandledZodDescription && "description" in schema__._def) {
|
532
|
+
const json = zodToJsonSchema(schema__, {
|
533
|
+
...options,
|
534
|
+
isHandledZodDescription: true
|
535
|
+
});
|
536
|
+
return {
|
537
|
+
description: schema__._def.description,
|
538
|
+
...json
|
539
|
+
};
|
540
|
+
}
|
531
541
|
if (!options?.isHandledCustomJSONSchema) {
|
532
542
|
const customJSONSchema = getCustomJSONSchema(schema__._def, options);
|
533
543
|
if (customJSONSchema) {
|
package/dist/src/converter.d.ts
CHANGED
@@ -35,6 +35,12 @@ export interface ZodToJsonSchemaOptions {
|
|
35
35
|
* @internal
|
36
36
|
*/
|
37
37
|
isHandledCustomJSONSchema?: boolean;
|
38
|
+
/**
|
39
|
+
* Track if current level schema is handled zod description to prevent recursive
|
40
|
+
*
|
41
|
+
* @internal
|
42
|
+
*/
|
43
|
+
isHandledZodDescription?: boolean;
|
38
44
|
}
|
39
45
|
export declare function zodToJsonSchema(schema: StandardSchemaV1, options?: ZodToJsonSchemaOptions): Exclude<JSONSchema.JSONSchema, boolean>;
|
40
46
|
export declare class ZodToJsonSchemaConverter implements SchemaConverter {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/zod",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.24.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -29,7 +29,7 @@
|
|
29
29
|
"dist"
|
30
30
|
],
|
31
31
|
"peerDependencies": {
|
32
|
-
"@orpc/openapi": "0.
|
32
|
+
"@orpc/openapi": "0.24.0"
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
35
|
"json-schema-typed": "^8.0.1",
|