microsoft / microsoft/typespec
String enum members should be passable to decorators expecting strings
Open
design:needed
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
The following should work IMO:
```
enum ValidFormats {
ipv4, ipv6
}
@format(ValidFormats.ipv4)
scalar ipv4Address extends string;
```
I think the current error is correct - an enum member isn't assignable to string. But, if the decorator were instead declared using `valueof string` (ala #888), string enum members could be coerced to their string values.
Contributor guide
Assessment
This issue has not been assessed yet.