A
arktype2mo ago
Tom

how to fail validation quickly

I have a union of types where each has a top-level field with a literal version number. When valid data is given, arktype can very quickly discriminate between the models and return a result, but in instances where something is wrong (but the version field is present) and the input is large, it takes a very long time to reject (10s of seconds). So I'm curious to understand why this is (what's happening when validation fails that doesn't happen when it succeeds?), and if it can be improved?
1 Reply
ssalbdivad
ssalbdivad2mo ago
10s of seconds!? :mindblown: What is the input!? You can use myType.allows to get a boolean return as fast as possible if you don't need a specific error message, which is generally what would take the majority of the time to construct.

Did you find this page helpful?