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][TCGC]: Incorrect discriminator value of discriminator property if it's union type #676

Closed
4 tasks done
Tracked by #4300
archerzz opened this issue Apr 16, 2024 · 1 comment · Fixed by #680
Closed
4 tasks done
Tracked by #4300
Assignees
Labels
bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Comments

@archerzz
Copy link
Member

Describe the bug

See DocumentIntelligence. There is a union OperationKind defined as discriminator type: https://github.com/Azure/azure-rest-api-specs/blob/6fc313ed7a6e926d4409d4ddb435f6532922652f/specification/ai/DocumentIntelligence/models.tsp#L272

It's used as type of the discriminator of OperationDetails: https://github.com/Azure/azure-rest-api-specs/blob/6fc313ed7a6e926d4409d4ddb435f6532922652f/specification/ai/DocumentIntelligence/models.tsp#L1227

OperationDetails has a few child models. However, when TCGC parses those models, value of discriminator property of DocumentModelBuildOperationDetails.kind is false.
image

Reproduction

Just parse the tsp definition in the links above.

Checklist

  • Follow our Code of Conduct
  • Check that this issue is about the Azure libraries for typespec. For bug in the typespec language or core libraries file it in the TypeSpec repo
  • Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@archerzz archerzz added the bug Something isn't working label Apr 16, 2024
@archerzz archerzz added lib:tcgc Issues for @azure-tools/typespec-client-generator-core library and removed needs-area labels Apr 16, 2024
@tadelesh
Copy link
Member

It is another circular calculation issue.

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

Successfully merging a pull request may close this issue.

2 participants