microsoft / microsoft/typespec

Docs: interface.sourceInterfaces is empty at the time of applyDecoratorToType for a decorated operation

Open
#2,106 2 comments 0 reactions 0 assignees View on GitHub
docs
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

Compare the state of interface.sourceInterfaces for the $graphRoute function for the @graphRoute decorator

```
@graphRoute("users/{userId}/children/{childId}")
@test interface interface1 extends TypeSpec.MsGraph.CollectionNavigationSource {
@test @get op get(graphRouteParams: string): entity[];
}
```
vs
```
interface interface1 extends TypeSpec.MsGraph.CollectionNavigationSource {
@graphRoute("users/{userId}/children/{childId}")
@test @get op get(graphRouteParams: string): entity[];
}
```

In the former case, in the call to $graphRoute, the interface's sourceInterfaces collection contains the extended type.

In the latter case, the operation's operation.interface.sourceInterfaces is an empty array.

To be able to write code that depends on that extended interface that follows the usual pattern of applying at either level, we need sourceInterfaces to be populated consistently before the decorators are applied.

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.