Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug][getAllOperations]: alias model is not calculated #69

Closed
Tracked by #4300
archerzz opened this issue Jan 2, 2024 · 6 comments
Closed
Tracked by #4300

[Bug][getAllOperations]: alias model is not calculated #69

archerzz opened this issue Jan 2, 2024 · 6 comments
Assignees
Labels
bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Comments

@archerzz
Copy link
Member

archerzz commented Jan 2, 2024

Describe the bug

  • If a normal anonymous model is defined, it will be given a name in TCGC.
  • If an anonymous model is defined through alias, it won't be given a name.

I found that usage of alias model is not calculated as well. It's always None.

To Reproduce
Try to compile the test case using getAllOperations branch: https://github.com/Azure/autorest.csharp/blob/31e7b662d82c01fa8e6725437c1daa2227a2aeb8/test/TestProjects/Spread-TypeSpec/Spread-TypeSpec.tsp#L97-L101

Expected behavior
Anonymous model defined by an alias should be calculated.

@archerzz archerzz added the bug Something isn't working label Jan 2, 2024
@archerzz archerzz changed the title [Bug][getAllOperations]: alias model name is empty [Bug][getAllOperations]: alias model is not calculated Jan 2, 2024
@markcowl markcowl added the lib:tcgc Issues for @azure-tools/typespec-client-generator-core library label Jan 8, 2024
@tadelesh tadelesh self-assigned this Feb 6, 2024
@iscai-msft
Copy link
Contributor

we shouldn't be returning models that are aliases, so if anything we need to make sure that we're not returning aliases

@tadelesh
Copy link
Member

we shouldn't be returning models that are aliases, so if anything we need to make sure that we're not returning aliases

Current getAllModels will return alias model. I don't remember clearly if it is because after compiling, we could not distinguish a model type is from model or alias definition.

@tadelesh
Copy link
Member

follow up with tsp team to see how to separate them.

@tadelesh
Copy link
Member

Folk the alias problem into another issue: #300

@tadelesh
Copy link
Member

This issue is likely a usage calculation problem. Will investigate soon.

@iscai-msft
Copy link
Contributor

closing in favor of #300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library
Projects
None yet
Development

No branches or pull requests

5 participants