microsoft / microsoft/typespec
TypeSpec supports all reserved keywords as model property keys.
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
### Clear and concise description of the problem
```tsp
model Test {
// import:string;
// model:string;
// scalar:string;
// enum:string;
// union:string;
// interface:string;
// op:string;
// namespace:string;
// using:string;
// is:string;
// extends:string;
// alias:string;
// const:string;
// etc...
}
```
current solution: provides an escaping mechanism using backticks (`) or bouble quote (").
```tsp
model Test {
"import" :string;
"model" :string;
"scalar" :string;
"enum" :string;
"union" :string;
"interface" :string;
"op" :string;
"namespace" :string;
"using" :string;
"is" :string;
"extends" :string;
"alias" :string;
"const" :string;
// etc...
}
```
### Checklist
- [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md)
- [x] Read the [docs](https://typespec.io/docs/).
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Contributor guide
Research direction
Start by reviewing the TypeSpec documentation and the existing escaped-property syntax shown in the issue. Identify how reserved keywords are parsed as model property keys, then verify that the listed keywords work without escaping while existing syntax remains valid.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100