microsoft / microsoft/typespec

Make `@pattern` decorator a decorator that can validate values

Open
#7,054 1 comment 0 reactions 0 assignees View on GitHub
compiler:core feature triaged:core
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

Like we already have for `@minValue`, `@minLength`, etc. we could make `@pattern` a known value validator

Would be good to get this

```tsp
@pattern(".+\\@.+\\..+")
scalar email extends string;

const a: email = "abc";
^ error
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.