Hyperlinkv0.8.0-beta.28

Schema

Schema.isGUIDfunctioneffect/Schema.ts:6718
(annotations?: Annotations.Filter): SchemaAST.Filter<string>

Validates that a string has the GUID / UUID textual shape.

When to use

Use when you need to accept dashed hexadecimal identifiers without enforcing UUID version or variant bits.

Details

This check accepts strings in the 8-4-4-4-12 hexadecimal form. JSON Schema output includes the corresponding pattern constraint and intentionally does not include format: "uuid" because GUID validation is looser than UUID validation.

Arbitrary:

When generating test data with fast-check, this applies a patterns constraint to ensure generated strings match the GUID pattern.

String checksisUUID
Source effect/Schema.ts:671813 lines
export function isGUID(annotations?: Annotations.Filter) {
  return isPattern(
    GUID_REGEXP,
    {
      expected: "a GUID",
      meta: {
        _tag: "isGUID",
        regExp: GUID_REGEXP
      },
      ...annotations
    }
  )
}
Referenced by 1 symbols