Skip to content

'string.uuid' only requires prefix #1601

@zb140

Description

@zb140

Report a bug

type('string.uuid') considers strings valid as long as they begin with a UUID. It looks like this is because the versioned regex is missing a $ at the end. See the playground link for an example.

Workaround: type('string.uuid == 36')

🔎 Search Terms

UUID

🧩 Context

  • ArkType version: 2.2.0
  • TypeScript version (5.1+): 5.9.3
  • Other context you think may be relevant (JS flavor, OS, etc.):

🧑‍💻 Repro

Playground Link: https://arktype.io/playground?code=import%2520%257B%2520type%2520%257D%2520from%2520%2522arktype%2522%250A%250Aconst%2520Thing%2520%253D%2520type%28%257B%250A%2520%2520%2520%2520id%253A%2520%27string.uuid%27%252C%250A%2520%2520%2520%2520extra%253A%2520%27string.uuid%27%250A%257D%29%250A%250Aconst%2520out%2520%253D%2520Thing%28%257B%250A%2520%2520%2520%2520id%253A%2520%2522dbb1e8e0-40fc-4c14-87eb-61b25d166a1b%2522%252C%250A%2520%2520%2520%2520extra%253A%2520%2522dbb1e8e0-40fc-4c14-87eb-61b25d166a1b%2520other%2520stuff%2520goes%2520here%2522%250A%257D%29%250A

import { type } from "arktype"

const Thing = type({
    id: 'string.uuid',
    extra: 'string.uuid'
})

const out = Thing({
    id: "dbb1e8e0-40fc-4c14-87eb-61b25d166a1b",
    extra: "dbb1e8e0-40fc-4c14-87eb-61b25d166a1b other stuff goes here"
})

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions