yomichan icon indicating copy to clipboard operation
yomichan copied to clipboard

JSON schema validation

Open toasted-nutbread opened this issue 3 years ago • 2 comments

Schema validation of data is sub-optimal and can cause significant slowdowns for large and complex dictionary files. Some issues were brought up in this comment: https://github.com/FooSoft/yomichan/pull/2129#issuecomment-1126785466.

This issue is intended to track issues and other information related to this topic.

Related issues:

  • #2129
  • #2136
  • #2137

toasted-nutbread avatar May 17 '22 00:05 toasted-nutbread

Using ajv poses some issues related to content security policy if not compiled: https://ajv.js.org/guide/environments.html#browsers

toasted-nutbread avatar May 17 '22 00:05 toasted-nutbread

One place where ajv wouldn't be able to be used is profile condition validation. Profile conditions are translated to JSON schemas, which are then parsed using JsonSchema. Since ajv uses function constructors, it wouldn't be usable for this. However, falling back to the built-in JsonSchema is not really that bad, since the schemas it's validating are very small.

toasted-nutbread avatar May 19 '22 02:05 toasted-nutbread