@nocobase/plugin-mcp-server 2.2.0-beta.7 → 2.2.0-beta.9
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/externalVersion.js +6 -6
- package/dist/node_modules/light-my-request/package.json +1 -1
- package/dist/node_modules/openapi-types/package.json +1 -1
- package/package.json +2 -2
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/.github/CR_logotype-full-color.png +0 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/.github/FUNDING.yml +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/.prettierrc.json +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/LICENSE +0 -15
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/README.md +0 -390
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/changelog.md +0 -83
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/contributing.md +0 -9
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/createIndex.ts +0 -32
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/Options.js +0 -51
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/Refs.js +0 -26
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/errorMessages.js +0 -19
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/getRelativePath.js +0 -12
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/index.js +0 -56
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/package.json +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parseDef.js +0 -66
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parseTypes.js +0 -2
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/any.js +0 -21
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/array.js +0 -30
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/bigint.js +0 -53
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/boolean.js +0 -9
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/branded.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/catch.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/date.js +0 -50
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/default.js +0 -11
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/effects.js +0 -11
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/enum.js +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/intersection.js +0 -56
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/literal.js +0 -25
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/map.js +0 -30
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/nativeEnum.js +0 -20
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/never.js +0 -15
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/null.js +0 -14
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/nullable.js +0 -37
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/number.js +0 -56
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js +0 -76
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/optional.js +0 -25
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/pipeline.js +0 -24
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/promise.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/readonly.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/record.js +0 -65
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/set.js +0 -24
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/string.js +0 -356
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/tuple.js +0 -36
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/undefined.js +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/union.js +0 -84
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/parsers/unknown.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/selectParser.js +0 -109
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/cjs/zodToJsonSchema.js +0 -90
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/Options.js +0 -46
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/Refs.js +0 -22
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +0 -14
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/index.js +0 -40
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/package.json +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parseDef.js +0 -62
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parseTypes.js +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +0 -17
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +0 -26
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +0 -49
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +0 -5
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +0 -46
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +0 -7
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +0 -7
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +0 -52
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +0 -21
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +0 -26
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +0 -16
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +0 -11
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +0 -33
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +0 -52
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +0 -72
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +0 -21
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +0 -20
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +0 -61
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +0 -20
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +0 -352
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +0 -32
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +0 -80
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/selectParser.js +0 -105
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +0 -87
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/Options.d.ts +0 -37
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/Refs.d.ts +0 -17
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/errorMessages.d.ts +0 -15
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/getRelativePath.d.ts +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/index.d.ts +0 -40
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parseDef.d.ts +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parseTypes.d.ts +0 -34
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/any.d.ts +0 -5
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/array.d.ts +0 -12
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/bigint.d.ts +0 -14
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/boolean.d.ts +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/branded.d.ts +0 -3
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/catch.d.ts +0 -3
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/date.d.ts +0 -15
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/default.d.ts +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/effects.d.ts +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/enum.d.ts +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/intersection.d.ts +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/literal.d.ts +0 -9
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/map.d.ts +0 -15
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/nativeEnum.d.ts +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/never.d.ts +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/null.d.ts +0 -5
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/nullable.d.ts +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/number.d.ts +0 -13
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/object.d.ts +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/optional.d.ts +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/pipeline.d.ts +0 -5
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/promise.d.ts +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/readonly.d.ts +0 -3
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/record.d.ts +0 -13
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/set.d.ts +0 -13
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/string.d.ts +0 -73
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/tuple.d.ts +0 -13
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/undefined.d.ts +0 -6
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/union.d.ts +0 -23
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/parsers/unknown.d.ts +0 -4
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/selectParser.d.ts +0 -5
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/types/zodToJsonSchema.d.ts +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/package.json +0 -85
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/postcjs.ts +0 -3
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/postesm.ts +0 -3
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zodToJsonSchema = void 0;
|
|
4
|
-
const parseDef_js_1 = require("./parseDef.js");
|
|
5
|
-
const Refs_js_1 = require("./Refs.js");
|
|
6
|
-
const any_js_1 = require("./parsers/any.js");
|
|
7
|
-
const zodToJsonSchema = (schema, options) => {
|
|
8
|
-
const refs = (0, Refs_js_1.getRefs)(options);
|
|
9
|
-
let definitions = typeof options === "object" && options.definitions
|
|
10
|
-
? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({
|
|
11
|
-
...acc,
|
|
12
|
-
[name]: (0, parseDef_js_1.parseDef)(schema._def, {
|
|
13
|
-
...refs,
|
|
14
|
-
currentPath: [...refs.basePath, refs.definitionPath, name],
|
|
15
|
-
}, true) ?? (0, any_js_1.parseAnyDef)(refs),
|
|
16
|
-
}), {})
|
|
17
|
-
: undefined;
|
|
18
|
-
const name = typeof options === "string"
|
|
19
|
-
? options
|
|
20
|
-
: options?.nameStrategy === "title"
|
|
21
|
-
? undefined
|
|
22
|
-
: options?.name;
|
|
23
|
-
const main = (0, parseDef_js_1.parseDef)(schema._def, name === undefined
|
|
24
|
-
? refs
|
|
25
|
-
: {
|
|
26
|
-
...refs,
|
|
27
|
-
currentPath: [...refs.basePath, refs.definitionPath, name],
|
|
28
|
-
}, false) ?? (0, any_js_1.parseAnyDef)(refs);
|
|
29
|
-
const title = typeof options === "object" &&
|
|
30
|
-
options.name !== undefined &&
|
|
31
|
-
options.nameStrategy === "title"
|
|
32
|
-
? options.name
|
|
33
|
-
: undefined;
|
|
34
|
-
if (title !== undefined) {
|
|
35
|
-
main.title = title;
|
|
36
|
-
}
|
|
37
|
-
if (refs.flags.hasReferencedOpenAiAnyType) {
|
|
38
|
-
if (!definitions) {
|
|
39
|
-
definitions = {};
|
|
40
|
-
}
|
|
41
|
-
if (!definitions[refs.openAiAnyTypeName]) {
|
|
42
|
-
definitions[refs.openAiAnyTypeName] = {
|
|
43
|
-
// Skipping "object" as no properties can be defined and additionalProperties must be "false"
|
|
44
|
-
type: ["string", "number", "integer", "boolean", "array", "null"],
|
|
45
|
-
items: {
|
|
46
|
-
$ref: refs.$refStrategy === "relative"
|
|
47
|
-
? "1"
|
|
48
|
-
: [
|
|
49
|
-
...refs.basePath,
|
|
50
|
-
refs.definitionPath,
|
|
51
|
-
refs.openAiAnyTypeName,
|
|
52
|
-
].join("/"),
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
const combined = name === undefined
|
|
58
|
-
? definitions
|
|
59
|
-
? {
|
|
60
|
-
...main,
|
|
61
|
-
[refs.definitionPath]: definitions,
|
|
62
|
-
}
|
|
63
|
-
: main
|
|
64
|
-
: {
|
|
65
|
-
$ref: [
|
|
66
|
-
...(refs.$refStrategy === "relative" ? [] : refs.basePath),
|
|
67
|
-
refs.definitionPath,
|
|
68
|
-
name,
|
|
69
|
-
].join("/"),
|
|
70
|
-
[refs.definitionPath]: {
|
|
71
|
-
...definitions,
|
|
72
|
-
[name]: main,
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
if (refs.target === "jsonSchema7") {
|
|
76
|
-
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
77
|
-
}
|
|
78
|
-
else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
|
|
79
|
-
combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
|
|
80
|
-
}
|
|
81
|
-
if (refs.target === "openAi" &&
|
|
82
|
-
("anyOf" in combined ||
|
|
83
|
-
"oneOf" in combined ||
|
|
84
|
-
"allOf" in combined ||
|
|
85
|
-
("type" in combined && Array.isArray(combined.type)))) {
|
|
86
|
-
console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
|
|
87
|
-
}
|
|
88
|
-
return combined;
|
|
89
|
-
};
|
|
90
|
-
exports.zodToJsonSchema = zodToJsonSchema;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export const ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
2
|
-
export const jsonDescription = (jsonSchema, def) => {
|
|
3
|
-
if (def.description) {
|
|
4
|
-
try {
|
|
5
|
-
return {
|
|
6
|
-
...jsonSchema,
|
|
7
|
-
...JSON.parse(def.description),
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
catch { }
|
|
11
|
-
}
|
|
12
|
-
return jsonSchema;
|
|
13
|
-
};
|
|
14
|
-
export const defaultOptions = {
|
|
15
|
-
name: undefined,
|
|
16
|
-
$refStrategy: "root",
|
|
17
|
-
basePath: ["#"],
|
|
18
|
-
effectStrategy: "input",
|
|
19
|
-
pipeStrategy: "all",
|
|
20
|
-
dateStrategy: "format:date-time",
|
|
21
|
-
mapStrategy: "entries",
|
|
22
|
-
removeAdditionalStrategy: "passthrough",
|
|
23
|
-
allowedAdditionalProperties: true,
|
|
24
|
-
rejectedAdditionalProperties: false,
|
|
25
|
-
definitionPath: "definitions",
|
|
26
|
-
target: "jsonSchema7",
|
|
27
|
-
strictUnions: false,
|
|
28
|
-
definitions: {},
|
|
29
|
-
errorMessages: false,
|
|
30
|
-
markdownDescription: false,
|
|
31
|
-
patternStrategy: "escape",
|
|
32
|
-
applyRegexFlags: false,
|
|
33
|
-
emailStrategy: "format:email",
|
|
34
|
-
base64Strategy: "contentEncoding:base64",
|
|
35
|
-
nameStrategy: "ref",
|
|
36
|
-
openAiAnyTypeName: "OpenAiAnyType"
|
|
37
|
-
};
|
|
38
|
-
export const getDefaultOptions = (options) => (typeof options === "string"
|
|
39
|
-
? {
|
|
40
|
-
...defaultOptions,
|
|
41
|
-
name: options,
|
|
42
|
-
}
|
|
43
|
-
: {
|
|
44
|
-
...defaultOptions,
|
|
45
|
-
...options,
|
|
46
|
-
});
|
package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema/dist/esm/Refs.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getDefaultOptions } from "./Options.js";
|
|
2
|
-
export const getRefs = (options) => {
|
|
3
|
-
const _options = getDefaultOptions(options);
|
|
4
|
-
const currentPath = _options.name !== undefined
|
|
5
|
-
? [..._options.basePath, _options.definitionPath, _options.name]
|
|
6
|
-
: _options.basePath;
|
|
7
|
-
return {
|
|
8
|
-
..._options,
|
|
9
|
-
flags: { hasReferencedOpenAiAnyType: false },
|
|
10
|
-
currentPath: currentPath,
|
|
11
|
-
propertyPath: undefined,
|
|
12
|
-
seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
|
|
13
|
-
def._def,
|
|
14
|
-
{
|
|
15
|
-
def: def._def,
|
|
16
|
-
path: [..._options.basePath, _options.definitionPath, name],
|
|
17
|
-
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
18
|
-
jsonSchema: undefined,
|
|
19
|
-
},
|
|
20
|
-
])),
|
|
21
|
-
};
|
|
22
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function addErrorMessage(res, key, errorMessage, refs) {
|
|
2
|
-
if (!refs?.errorMessages)
|
|
3
|
-
return;
|
|
4
|
-
if (errorMessage) {
|
|
5
|
-
res.errorMessage = {
|
|
6
|
-
...res.errorMessage,
|
|
7
|
-
[key]: errorMessage,
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
12
|
-
res[key] = value;
|
|
13
|
-
addErrorMessage(res, key, errorMessage, refs);
|
|
14
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export * from "./Options.js";
|
|
2
|
-
export * from "./Refs.js";
|
|
3
|
-
export * from "./errorMessages.js";
|
|
4
|
-
export * from "./getRelativePath.js";
|
|
5
|
-
export * from "./parseDef.js";
|
|
6
|
-
export * from "./parseTypes.js";
|
|
7
|
-
export * from "./parsers/any.js";
|
|
8
|
-
export * from "./parsers/array.js";
|
|
9
|
-
export * from "./parsers/bigint.js";
|
|
10
|
-
export * from "./parsers/boolean.js";
|
|
11
|
-
export * from "./parsers/branded.js";
|
|
12
|
-
export * from "./parsers/catch.js";
|
|
13
|
-
export * from "./parsers/date.js";
|
|
14
|
-
export * from "./parsers/default.js";
|
|
15
|
-
export * from "./parsers/effects.js";
|
|
16
|
-
export * from "./parsers/enum.js";
|
|
17
|
-
export * from "./parsers/intersection.js";
|
|
18
|
-
export * from "./parsers/literal.js";
|
|
19
|
-
export * from "./parsers/map.js";
|
|
20
|
-
export * from "./parsers/nativeEnum.js";
|
|
21
|
-
export * from "./parsers/never.js";
|
|
22
|
-
export * from "./parsers/null.js";
|
|
23
|
-
export * from "./parsers/nullable.js";
|
|
24
|
-
export * from "./parsers/number.js";
|
|
25
|
-
export * from "./parsers/object.js";
|
|
26
|
-
export * from "./parsers/optional.js";
|
|
27
|
-
export * from "./parsers/pipeline.js";
|
|
28
|
-
export * from "./parsers/promise.js";
|
|
29
|
-
export * from "./parsers/readonly.js";
|
|
30
|
-
export * from "./parsers/record.js";
|
|
31
|
-
export * from "./parsers/set.js";
|
|
32
|
-
export * from "./parsers/string.js";
|
|
33
|
-
export * from "./parsers/tuple.js";
|
|
34
|
-
export * from "./parsers/undefined.js";
|
|
35
|
-
export * from "./parsers/union.js";
|
|
36
|
-
export * from "./parsers/unknown.js";
|
|
37
|
-
export * from "./selectParser.js";
|
|
38
|
-
export * from "./zodToJsonSchema.js";
|
|
39
|
-
import { zodToJsonSchema } from "./zodToJsonSchema.js";
|
|
40
|
-
export default zodToJsonSchema;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module","main":"index.js"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { ignoreOverride } from "./Options.js";
|
|
2
|
-
import { selectParser } from "./selectParser.js";
|
|
3
|
-
import { getRelativePath } from "./getRelativePath.js";
|
|
4
|
-
import { parseAnyDef } from "./parsers/any.js";
|
|
5
|
-
export function parseDef(def, refs, forceResolution = false) {
|
|
6
|
-
const seenItem = refs.seen.get(def);
|
|
7
|
-
if (refs.override) {
|
|
8
|
-
const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
|
|
9
|
-
if (overrideResult !== ignoreOverride) {
|
|
10
|
-
return overrideResult;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
if (seenItem && !forceResolution) {
|
|
14
|
-
const seenSchema = get$ref(seenItem, refs);
|
|
15
|
-
if (seenSchema !== undefined) {
|
|
16
|
-
return seenSchema;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
const newItem = { def, path: refs.currentPath, jsonSchema: undefined };
|
|
20
|
-
refs.seen.set(def, newItem);
|
|
21
|
-
const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
|
|
22
|
-
// If the return was a function, then the inner definition needs to be extracted before a call to parseDef (recursive)
|
|
23
|
-
const jsonSchema = typeof jsonSchemaOrGetter === "function"
|
|
24
|
-
? parseDef(jsonSchemaOrGetter(), refs)
|
|
25
|
-
: jsonSchemaOrGetter;
|
|
26
|
-
if (jsonSchema) {
|
|
27
|
-
addMeta(def, refs, jsonSchema);
|
|
28
|
-
}
|
|
29
|
-
if (refs.postProcess) {
|
|
30
|
-
const postProcessResult = refs.postProcess(jsonSchema, def, refs);
|
|
31
|
-
newItem.jsonSchema = jsonSchema;
|
|
32
|
-
return postProcessResult;
|
|
33
|
-
}
|
|
34
|
-
newItem.jsonSchema = jsonSchema;
|
|
35
|
-
return jsonSchema;
|
|
36
|
-
}
|
|
37
|
-
const get$ref = (item, refs) => {
|
|
38
|
-
switch (refs.$refStrategy) {
|
|
39
|
-
case "root":
|
|
40
|
-
return { $ref: item.path.join("/") };
|
|
41
|
-
case "relative":
|
|
42
|
-
return { $ref: getRelativePath(refs.currentPath, item.path) };
|
|
43
|
-
case "none":
|
|
44
|
-
case "seen": {
|
|
45
|
-
if (item.path.length < refs.currentPath.length &&
|
|
46
|
-
item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
47
|
-
console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
|
|
48
|
-
return parseAnyDef(refs);
|
|
49
|
-
}
|
|
50
|
-
return refs.$refStrategy === "seen" ? parseAnyDef(refs) : undefined;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const addMeta = (def, refs, jsonSchema) => {
|
|
55
|
-
if (def.description) {
|
|
56
|
-
jsonSchema.description = def.description;
|
|
57
|
-
if (refs.markdownDescription) {
|
|
58
|
-
jsonSchema.markdownDescription = def.description;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return jsonSchema;
|
|
62
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { getRelativePath } from "../getRelativePath.js";
|
|
2
|
-
export function parseAnyDef(refs) {
|
|
3
|
-
if (refs.target !== "openAi") {
|
|
4
|
-
return {};
|
|
5
|
-
}
|
|
6
|
-
const anyDefinitionPath = [
|
|
7
|
-
...refs.basePath,
|
|
8
|
-
refs.definitionPath,
|
|
9
|
-
refs.openAiAnyTypeName,
|
|
10
|
-
];
|
|
11
|
-
refs.flags.hasReferencedOpenAiAnyType = true;
|
|
12
|
-
return {
|
|
13
|
-
$ref: refs.$refStrategy === "relative"
|
|
14
|
-
? getRelativePath(anyDefinitionPath, refs.currentPath)
|
|
15
|
-
: anyDefinitionPath.join("/"),
|
|
16
|
-
};
|
|
17
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ZodFirstPartyTypeKind } from "zod/v3";
|
|
2
|
-
import { setResponseValueAndErrors } from "../errorMessages.js";
|
|
3
|
-
import { parseDef } from "../parseDef.js";
|
|
4
|
-
export function parseArrayDef(def, refs) {
|
|
5
|
-
const res = {
|
|
6
|
-
type: "array",
|
|
7
|
-
};
|
|
8
|
-
if (def.type?._def &&
|
|
9
|
-
def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) {
|
|
10
|
-
res.items = parseDef(def.type._def, {
|
|
11
|
-
...refs,
|
|
12
|
-
currentPath: [...refs.currentPath, "items"],
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
if (def.minLength) {
|
|
16
|
-
setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
|
|
17
|
-
}
|
|
18
|
-
if (def.maxLength) {
|
|
19
|
-
setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
|
|
20
|
-
}
|
|
21
|
-
if (def.exactLength) {
|
|
22
|
-
setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
|
|
23
|
-
setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
|
|
24
|
-
}
|
|
25
|
-
return res;
|
|
26
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { setResponseValueAndErrors } from "../errorMessages.js";
|
|
2
|
-
export function parseBigintDef(def, refs) {
|
|
3
|
-
const res = {
|
|
4
|
-
type: "integer",
|
|
5
|
-
format: "int64",
|
|
6
|
-
};
|
|
7
|
-
if (!def.checks)
|
|
8
|
-
return res;
|
|
9
|
-
for (const check of def.checks) {
|
|
10
|
-
switch (check.kind) {
|
|
11
|
-
case "min":
|
|
12
|
-
if (refs.target === "jsonSchema7") {
|
|
13
|
-
if (check.inclusive) {
|
|
14
|
-
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
if (!check.inclusive) {
|
|
22
|
-
res.exclusiveMinimum = true;
|
|
23
|
-
}
|
|
24
|
-
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
25
|
-
}
|
|
26
|
-
break;
|
|
27
|
-
case "max":
|
|
28
|
-
if (refs.target === "jsonSchema7") {
|
|
29
|
-
if (check.inclusive) {
|
|
30
|
-
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
if (!check.inclusive) {
|
|
38
|
-
res.exclusiveMaximum = true;
|
|
39
|
-
}
|
|
40
|
-
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
41
|
-
}
|
|
42
|
-
break;
|
|
43
|
-
case "multipleOf":
|
|
44
|
-
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return res;
|
|
49
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { setResponseValueAndErrors } from "../errorMessages.js";
|
|
2
|
-
export function parseDateDef(def, refs, overrideDateStrategy) {
|
|
3
|
-
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
4
|
-
if (Array.isArray(strategy)) {
|
|
5
|
-
return {
|
|
6
|
-
anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)),
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
switch (strategy) {
|
|
10
|
-
case "string":
|
|
11
|
-
case "format:date-time":
|
|
12
|
-
return {
|
|
13
|
-
type: "string",
|
|
14
|
-
format: "date-time",
|
|
15
|
-
};
|
|
16
|
-
case "format:date":
|
|
17
|
-
return {
|
|
18
|
-
type: "string",
|
|
19
|
-
format: "date",
|
|
20
|
-
};
|
|
21
|
-
case "integer":
|
|
22
|
-
return integerDateParser(def, refs);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const integerDateParser = (def, refs) => {
|
|
26
|
-
const res = {
|
|
27
|
-
type: "integer",
|
|
28
|
-
format: "unix-time",
|
|
29
|
-
};
|
|
30
|
-
if (refs.target === "openApi3") {
|
|
31
|
-
return res;
|
|
32
|
-
}
|
|
33
|
-
for (const check of def.checks) {
|
|
34
|
-
switch (check.kind) {
|
|
35
|
-
case "min":
|
|
36
|
-
setResponseValueAndErrors(res, "minimum", check.value, // This is in milliseconds
|
|
37
|
-
check.message, refs);
|
|
38
|
-
break;
|
|
39
|
-
case "max":
|
|
40
|
-
setResponseValueAndErrors(res, "maximum", check.value, // This is in milliseconds
|
|
41
|
-
check.message, refs);
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return res;
|
|
46
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { parseDef } from "../parseDef.js";
|
|
2
|
-
const isJsonSchema7AllOfType = (type) => {
|
|
3
|
-
if ("type" in type && type.type === "string")
|
|
4
|
-
return false;
|
|
5
|
-
return "allOf" in type;
|
|
6
|
-
};
|
|
7
|
-
export function parseIntersectionDef(def, refs) {
|
|
8
|
-
const allOf = [
|
|
9
|
-
parseDef(def.left._def, {
|
|
10
|
-
...refs,
|
|
11
|
-
currentPath: [...refs.currentPath, "allOf", "0"],
|
|
12
|
-
}),
|
|
13
|
-
parseDef(def.right._def, {
|
|
14
|
-
...refs,
|
|
15
|
-
currentPath: [...refs.currentPath, "allOf", "1"],
|
|
16
|
-
}),
|
|
17
|
-
].filter((x) => !!x);
|
|
18
|
-
let unevaluatedProperties = refs.target === "jsonSchema2019-09"
|
|
19
|
-
? { unevaluatedProperties: false }
|
|
20
|
-
: undefined;
|
|
21
|
-
const mergedAllOf = [];
|
|
22
|
-
// If either of the schemas is an allOf, merge them into a single allOf
|
|
23
|
-
allOf.forEach((schema) => {
|
|
24
|
-
if (isJsonSchema7AllOfType(schema)) {
|
|
25
|
-
mergedAllOf.push(...schema.allOf);
|
|
26
|
-
if (schema.unevaluatedProperties === undefined) {
|
|
27
|
-
// If one of the schemas has no unevaluatedProperties set,
|
|
28
|
-
// the merged schema should also have no unevaluatedProperties set
|
|
29
|
-
unevaluatedProperties = undefined;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
let nestedSchema = schema;
|
|
34
|
-
if ("additionalProperties" in schema &&
|
|
35
|
-
schema.additionalProperties === false) {
|
|
36
|
-
const { additionalProperties, ...rest } = schema;
|
|
37
|
-
nestedSchema = rest;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
// As soon as one of the schemas has additionalProperties set not to false, we allow unevaluatedProperties
|
|
41
|
-
unevaluatedProperties = undefined;
|
|
42
|
-
}
|
|
43
|
-
mergedAllOf.push(nestedSchema);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return mergedAllOf.length
|
|
47
|
-
? {
|
|
48
|
-
allOf: mergedAllOf,
|
|
49
|
-
...unevaluatedProperties,
|
|
50
|
-
}
|
|
51
|
-
: undefined;
|
|
52
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export function parseLiteralDef(def, refs) {
|
|
2
|
-
const parsedType = typeof def.value;
|
|
3
|
-
if (parsedType !== "bigint" &&
|
|
4
|
-
parsedType !== "number" &&
|
|
5
|
-
parsedType !== "boolean" &&
|
|
6
|
-
parsedType !== "string") {
|
|
7
|
-
return {
|
|
8
|
-
type: Array.isArray(def.value) ? "array" : "object",
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
if (refs.target === "openApi3") {
|
|
12
|
-
return {
|
|
13
|
-
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
14
|
-
enum: [def.value],
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
19
|
-
const: def.value,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { parseDef } from "../parseDef.js";
|
|
2
|
-
import { parseRecordDef } from "./record.js";
|
|
3
|
-
import { parseAnyDef } from "./any.js";
|
|
4
|
-
export function parseMapDef(def, refs) {
|
|
5
|
-
if (refs.mapStrategy === "record") {
|
|
6
|
-
return parseRecordDef(def, refs);
|
|
7
|
-
}
|
|
8
|
-
const keys = parseDef(def.keyType._def, {
|
|
9
|
-
...refs,
|
|
10
|
-
currentPath: [...refs.currentPath, "items", "items", "0"],
|
|
11
|
-
}) || parseAnyDef(refs);
|
|
12
|
-
const values = parseDef(def.valueType._def, {
|
|
13
|
-
...refs,
|
|
14
|
-
currentPath: [...refs.currentPath, "items", "items", "1"],
|
|
15
|
-
}) || parseAnyDef(refs);
|
|
16
|
-
return {
|
|
17
|
-
type: "array",
|
|
18
|
-
maxItems: 125,
|
|
19
|
-
items: {
|
|
20
|
-
type: "array",
|
|
21
|
-
items: [keys, values],
|
|
22
|
-
minItems: 2,
|
|
23
|
-
maxItems: 2,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export function parseNativeEnumDef(def) {
|
|
2
|
-
const object = def.values;
|
|
3
|
-
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
4
|
-
return typeof object[object[key]] !== "number";
|
|
5
|
-
});
|
|
6
|
-
const actualValues = actualKeys.map((key) => object[key]);
|
|
7
|
-
const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
|
|
8
|
-
return {
|
|
9
|
-
type: parsedTypes.length === 1
|
|
10
|
-
? parsedTypes[0] === "string"
|
|
11
|
-
? "string"
|
|
12
|
-
: "number"
|
|
13
|
-
: ["string", "number"],
|
|
14
|
-
enum: actualValues,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { parseDef } from "../parseDef.js";
|
|
2
|
-
import { primitiveMappings } from "./union.js";
|
|
3
|
-
export function parseNullableDef(def, refs) {
|
|
4
|
-
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) &&
|
|
5
|
-
(!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
6
|
-
if (refs.target === "openApi3") {
|
|
7
|
-
return {
|
|
8
|
-
type: primitiveMappings[def.innerType._def.typeName],
|
|
9
|
-
nullable: true,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
return {
|
|
13
|
-
type: [
|
|
14
|
-
primitiveMappings[def.innerType._def.typeName],
|
|
15
|
-
"null",
|
|
16
|
-
],
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
if (refs.target === "openApi3") {
|
|
20
|
-
const base = parseDef(def.innerType._def, {
|
|
21
|
-
...refs,
|
|
22
|
-
currentPath: [...refs.currentPath],
|
|
23
|
-
});
|
|
24
|
-
if (base && "$ref" in base)
|
|
25
|
-
return { allOf: [base], nullable: true };
|
|
26
|
-
return base && { ...base, nullable: true };
|
|
27
|
-
}
|
|
28
|
-
const base = parseDef(def.innerType._def, {
|
|
29
|
-
...refs,
|
|
30
|
-
currentPath: [...refs.currentPath, "anyOf", "0"],
|
|
31
|
-
});
|
|
32
|
-
return base && { anyOf: [base, { type: "null" }] };
|
|
33
|
-
}
|