fix schema modals

This commit is contained in:
dswbx
2025-07-07 16:38:39 +02:00
parent 88ec3432a0
commit ea46dc8df0
4 changed files with 7 additions and 11 deletions
@@ -33,7 +33,7 @@ export class PasswordStrategy extends Strategy<typeof schema> {
private getPayloadSchema() {
return s.object({
email: s.string({
pattern: /^[\w-\.\+_]+@([\w-]+\.)+[\w-]{2,4}$/,
format: "email",
}),
password: s.string({
minLength: 8, // @todo: this should be configurable
@@ -23,7 +23,7 @@ export class JsonvTsValidator<T = any, S extends StrictRJSFSchema = RJSFSchema>
return { errors: [], validationError: null as any };
}
const jsSchema = s.fromSchema(schema as any);
const jsSchema = s.fromSchema(JSON.parse(JSON.stringify(schema)) as any);
const result = jsSchema.validate(formData);
if (result.valid) {
+1 -1
View File
@@ -65,7 +65,7 @@ export function SchemaFormModal({
<JsonSchemaForm
tagName="form"
ref={formRef}
schema={schema}
schema={JSON.parse(JSON.stringify(schema))}
uiSchema={uiSchema}
className="legacy hide-required-mark fieldset-alternative mute-root"
onChange={handleChange}
+4 -8
View File
@@ -6,7 +6,7 @@ import { Button } from "../../components/buttons/Button";
import { CellValue, DataTable } from "../../components/table/DataTable";
import * as AppShell from "../../layouts/AppShell/AppShell";
import { routes, useNavigate } from "../../lib/routes";
import { stringIdentifier } from "bknd/core";
import { s, stringIdentifier } from "bknd/core";
export function AuthRolesList() {
const [navigate] = useNavigate();
@@ -29,13 +29,9 @@ export function AuthRolesList() {
bkndModals.open(
"form",
{
schema: {
type: "object",
properties: {
name: stringIdentifier,
},
required: ["name"],
},
schema: s.strictObject({
name: stringIdentifier,
}),
uiSchema: {
name: {
"ui:title": "Role name",