fix schema updates with falsy values

This commit is contained in:
dswbx
2025-07-09 08:48:05 +02:00
parent 682ecc6dac
commit 0a49061549
5 changed files with 16 additions and 7 deletions
+1 -1
View File
@@ -99,7 +99,7 @@
"dotenv": "^16.4.7",
"jotai": "^2.12.2",
"jsdom": "^26.0.0",
"jsonv-ts": "^0.2.3",
"jsonv-ts": "^0.2.4",
"kysely-d1": "^0.3.0",
"kysely-generic-sqlite": "^1.2.1",
"libsql-stateless-easy": "^1.8.0",
+7 -1
View File
@@ -1,7 +1,13 @@
/// <reference types="@cloudflare/workers-types" />
import type { App } from "App";
import { datetimeStringLocal, datetimeStringUTC, getTimezone, getTimezoneOffset, $console } from "core/utils";
import {
datetimeStringLocal,
datetimeStringUTC,
getTimezone,
getTimezoneOffset,
$console,
} from "core/utils";
import { getRuntimeKey } from "core/utils";
import type { Context, Hono } from "hono";
import { Controller } from "modules/Controller";
@@ -4,10 +4,13 @@ import type { JSONSchema } from "json-schema-to-ts";
import type { JSONSchemaType } from "json-schema-to-ts/lib/types/definitions/jsonSchema";
export { isEqual, getPath } from "core/utils/objects";
//export { isEqual } from "lodash-es";
export function isNotDefined(value: any) {
return value === null || value === undefined || value === "";
}
export function coerce(value: any, schema: JsonSchema, opts?: { required?: boolean }) {
if (!value && typeof opts?.required === "boolean" && !opts.required) {
if (isNotDefined(value) && typeof opts?.required === "boolean" && !opts.required) {
return undefined;
}
+1 -1
View File
@@ -76,7 +76,7 @@ function AuthStrategiesListInternal() {
return (
<Form
schema={schema.toJSON()}
schema={schema as any}
initialValues={config}
onSubmit={handleSubmit}
options={formOptions}