yuppi 1.3.1 → 1.3.2
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/main.js +3 -3
- package/dist/main.mjs +3 -3
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -45,8 +45,8 @@ var import_path = __toESM(require("path"));
|
|
|
45
45
|
var import_typebox = require("@sinclair/typebox");
|
|
46
46
|
var convertToJSONSchema = (schema) => {
|
|
47
47
|
const base = (schema2, key, config) => {
|
|
48
|
-
if (!config.required) schema2 = import_typebox.Type.Optional(schema2);
|
|
49
48
|
if (config.nullable || config.default === null) schema2 = import_typebox.Type.Union([schema2, import_typebox.Type.Null()]);
|
|
49
|
+
if (!config.required) schema2 = import_typebox.Type.Optional(schema2);
|
|
50
50
|
return schema2;
|
|
51
51
|
};
|
|
52
52
|
const build = (key, config) => {
|
|
@@ -89,6 +89,8 @@ var Yup = __toESM(require("yup"));
|
|
|
89
89
|
var convertToYup = (schema, error_messages) => {
|
|
90
90
|
const base = (schema2, key, config) => {
|
|
91
91
|
schema2 = schema2.nullable();
|
|
92
|
+
if (config.default) schema2 = schema2.default(config.default);
|
|
93
|
+
if (!config.nullable && config.default !== null) schema2 = schema2.nonNullable(({ path: path2 }) => (error_messages?.base?.nullable ?? "").replaceAll("{path}", path2));
|
|
92
94
|
if (config.required)
|
|
93
95
|
schema2 = schema2.test(
|
|
94
96
|
"required",
|
|
@@ -100,8 +102,6 @@ var convertToYup = (schema, error_messages) => {
|
|
|
100
102
|
return true;
|
|
101
103
|
}
|
|
102
104
|
);
|
|
103
|
-
if (!config.nullable && config.default !== null) schema2 = schema2.nonNullable(({ path: path2 }) => (error_messages?.base?.nullable ?? "").replaceAll("{path}", path2));
|
|
104
|
-
if (config.default) schema2 = schema2.default(config.default);
|
|
105
105
|
return schema2;
|
|
106
106
|
};
|
|
107
107
|
const build = (key, config) => {
|
package/dist/main.mjs
CHANGED
|
@@ -14,8 +14,8 @@ import path from "path";
|
|
|
14
14
|
import { Type } from "@sinclair/typebox";
|
|
15
15
|
var convertToJSONSchema = (schema) => {
|
|
16
16
|
const base = (schema2, key, config) => {
|
|
17
|
-
if (!config.required) schema2 = Type.Optional(schema2);
|
|
18
17
|
if (config.nullable || config.default === null) schema2 = Type.Union([schema2, Type.Null()]);
|
|
18
|
+
if (!config.required) schema2 = Type.Optional(schema2);
|
|
19
19
|
return schema2;
|
|
20
20
|
};
|
|
21
21
|
const build = (key, config) => {
|
|
@@ -58,6 +58,8 @@ import * as Yup from "yup";
|
|
|
58
58
|
var convertToYup = (schema, error_messages) => {
|
|
59
59
|
const base = (schema2, key, config) => {
|
|
60
60
|
schema2 = schema2.nullable();
|
|
61
|
+
if (config.default) schema2 = schema2.default(config.default);
|
|
62
|
+
if (!config.nullable && config.default !== null) schema2 = schema2.nonNullable(({ path: path2 }) => (error_messages?.base?.nullable ?? "").replaceAll("{path}", path2));
|
|
61
63
|
if (config.required)
|
|
62
64
|
schema2 = schema2.test(
|
|
63
65
|
"required",
|
|
@@ -69,8 +71,6 @@ var convertToYup = (schema, error_messages) => {
|
|
|
69
71
|
return true;
|
|
70
72
|
}
|
|
71
73
|
);
|
|
72
|
-
if (!config.nullable && config.default !== null) schema2 = schema2.nonNullable(({ path: path2 }) => (error_messages?.base?.nullable ?? "").replaceAll("{path}", path2));
|
|
73
|
-
if (config.default) schema2 = schema2.default(config.default);
|
|
74
74
|
return schema2;
|
|
75
75
|
};
|
|
76
76
|
const build = (key, config) => {
|