fix json schema validation initialization

ensure `getJsonSchema` handles both object and non-object outputs to prevent errors during validation initialization. this improves robustness when handling edge cases in schema configurations.
This commit is contained in:
dswbx
2025-11-20 21:11:28 +01:00
parent a2fa11ccd0
commit 5c3eeb7642

View File

@@ -28,7 +28,10 @@ export class JsonSchemaField<
super(name, config); super(name, config);
// make sure to hand over clean json // make sure to hand over clean json
this.validator = new Validator(JSON.parse(JSON.stringify(this.getJsonSchema()))); const schema = this.getJsonSchema();
this.validator = new Validator(
typeof schema === "object" ? JSON.parse(JSON.stringify(schema)) : {},
);
} }
protected getSchema() { protected getSchema() {