microsoft / microsoft/typespec
Add support for uniqueness in collection types
Open
compiler:core
design:needed
triaged:core
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
Uniqueness in a collection of items is useful in many contexts, and could present important informations that can be used in documenting APIs and validating request and response values
- Bitfield-like unordered collections of enumerated values
- Sets of scalar types
- Keyed Types
This is supported in a limited fashio using the `@uniqueItems` decorator for Azure APIs, but the functionality could be useful in many API contexts.
This could be resolved using value assertions over existing collection types, or by using types like `Set`, `OrderedSet` that inherently require unique values.
Contributor guide
Assessment
This issue has not been assessed yet.