arktypea
arktype6mo ago
Wallce

dynamic key using string.uuid.v4 validating invalid strings.

Hi,

New to ArkType, so bear with me if this is answered, I couldn't find the relavent information on this topic. Here the link from playground: https://arktype.io/playground?code=import%2520%257B%2520type%2520%257D%2520from%2520%2522arktype%2522%250A%250Aconst%2520Thing%2520%253D%2520type%28%257B%250A%2509%2522%255Bstring.uuid.v4%255D%2522%253A%2520%2522%28number%2520%257C%2520string%29%2522%250A%257D%29%250A%250Aconst%2520out%2520%253D%2520Thing%28%257B%250A%2520%2520%2520%2520name%253A%2520%2522TypeScript%2522%252C%250A%2520%2520%2520%2520versions%253A%25207%250A%257D%29%250A

I would expect the out to show ArkErrors, but it's showing json output. This gives errors for plain "string.uuid" but shows keys like 0000..00 & ffff...fff as invalid, while not accounting the actual incorrect keys.

I assume I'm missing something. Please let me know the correct syntax if this is not the right way.
ArkType
TypeScript's 1:1 validator, optimized from editor to runtime
Was this page helpful?