(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.
export function function isGUID(
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.
isGUID(annotations: Annotations.Filter | undefinedannotations?: Annotations.interface Annotations.FilterAnnotations for filter schema nodes (created via Schema.filter). Extends
Augment
with an optional error message, identifier, and metadata.
Filters are intentionally non-parametric to keep them covariant.
Filter) {
return const isPattern: (
regExp: globalThis.RegExp,
annotations?: Annotations.Filter
) => SchemaAST.Filter<string>
Validates that a string matches the specified regular expression pattern.
Details
JSON Schema:
This check corresponds to the pattern constraint in JSON Schema.
Arbitrary:
When generating test data with fast-check, this applies a patterns
constraint to ensure generated strings match the specified RegExp pattern.
isPattern(
const GUID_REGEXP: globalThis.RegExpGUID_REGEXP,
{
Annotations.Augment.expected?: string | undefinedHuman-readable description of what a value is expected to satisfy.
Details
For filter and refinement failures, the default formatter uses
message first, then expected, and finally falls back to <filter>.
Use this to name a failed filter in the default message:
Expected <expected>, got <actual>.
expected: "a GUID",
Annotations.Filter.meta?: Annotations.Meta | undefined(property) Annotations.Filter.meta?: {
_tag: 'isGUID';
regExp: globalThis.RegExp;
}
Optional metadata used to identify or extend the filter with custom data.
meta: {
_tag: "isGUID"_tag: "isGUID",
regExp: globalThis.RegExpregExp: const GUID_REGEXP: globalThis.RegExpGUID_REGEXP
},
...annotations: Annotations.Filter | undefinedannotations
}
)
}