mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 20:37:21 +00:00
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:
@@ -28,7 +28,10 @@ export class JsonSchemaField<
|
||||
super(name, config);
|
||||
|
||||
// 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() {
|
||||
|
||||
Reference in New Issue
Block a user