microsoft / microsoft/typespec

Support `::name` metadata property

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

Description

Currently we have this legacy template interpolation for `@doc` which will look at the internal properties of the value passed.

```
@doc("{name}", T)
model Foo {}
```
[playground](https://typespec.io/playground?c=QGRvYygie25hbWV9IiwgVCkKbW9kZWwgRm9vPFQgZXh0ZW5kcyB7fT4ge30KCscdQmFyxQ%2FGDlRlc3QgewogIGE6xTdCYXI%2BOwp9&e=%40typespec%2Fopenapi3&options=%7B%7D)

This parameter is broken as it requires to be an object but it looks at the internal type properties(it doesn't actually interpolate the model properties)

We added string interpolation in a goal to remove fill that gap but it doesn't actually cover the only case where the formatArgs parameter did actually work.

We should find a way to have `::name` metadata property that we can use on templates args

```
@doc("${T::name}")
model Foo {}
```

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.