-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add test for @include over @internal #371
Conversation
🦋 Changeset detectedLatest commit: 137e950 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
packages/cadl-ranch-specs/http/azure/client-generator-core/internal/main.tsp
Outdated
Show resolved
Hide resolved
packages/cadl-ranch-specs/http/azure/client-generator-core/internal/main.tsp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Please take care of Timothee's comment.
PS: whether model is output-only or input-output actually affect Java class (guess .NET too), but that's language problem, no need to worry in tsp test.
@doc("This is a model only used by internal operation. Also, it is decorated with @include. It should be generated and exported.") | ||
@global.Azure.ClientGenerator.Core.include | ||
model InternaIncludelModel { | ||
name: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a nested model to also test transitivity?
Or, if we are not sure how transitivity works for @include
, I am fine to leave as this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think transitivity should be the work of isInclude
(though it seems current TCGC has not implemented it yet). I've created an issue to track.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should figure out this issue now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked the user's spec, it has nested model. So let's figure out how to handle it in this PR.
Added nested model in current test, and a fix for @include transitivity: https://github.com/Azure/typespec-azure/pull/3267. |
Cadl Ranch Contribution Checklist:
@scenario
names. Someone can look at the list of scenarios and understand what I'm covering.@scenarioDoc
s for extra scenario description and to tell people how to pass my mock api check.This test is from openai real use case: Azure/autorest.csharp#3519. The new added test could not be tested by mock server, different languages' SDK should add test for their generated code.
The logic emitter should accomplish:
isInternal
will returntrue
forInternaIncludelModel
modelisInclude
will returntrue
forInternaIncludelModel
modelInternaIncludelModel
will be included ingetAllModels
InternaIncludelModel
and make it public to user.