-
Notifications
You must be signed in to change notification settings - Fork 266
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
Align the client type shape from TCGC in our emitter #6179
Merged
ArcturusZhang
merged 33 commits into
microsoft:main
from
ArcturusZhang:align-tcgc-client-models
Mar 26, 2025
Merged
Align the client type shape from TCGC in our emitter #6179
ArcturusZhang
merged 33 commits into
microsoft:main
from
ArcturusZhang:align-tcgc-client-models
Mar 26, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
API change check API changes are not detected in this pull request. |
packages/http-client-csharp/emitter/test/Unit/input-parameter.test.ts
Outdated
Show resolved
Hide resolved
...r.Input/test/TestData/TypeSpecInputConverterTests/LoadsTypeSpecPagingInput/tspCodeModel.json
Outdated
Show resolved
Hide resolved
packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/common/InputFactory.cs
Outdated
Show resolved
Hide resolved
No changes needing a change description found. |
JoshLove-msft
approved these changes
Mar 20, 2025
mario-guerra
pushed a commit
that referenced
this pull request
Apr 2, 2025
Fixes #5924 Going forward to the ultimate goal of "only keep minimum code in our emitter, which should only parse and spit out the data from TCGC", this PR removes a few unnecessary code in our emitter, and align the structure of client in our emitter with the client from TCGC. Client initialization stuff has not been started therefore I still keep the property `parameters` on the client type to keep maximum compatibility and minimum the code change. I think the `parameters` could be gone once our client initialization work item was done. Operation stuff is also not changed, because the way TCGC represent operations/methods is different from ours. I also keep that part as a future work to align. About client names: Before, we did client name calculations in the emitter, to assign verbose name to subclients, such as: ``` namespace Service; namespace Foo { op one(): void; namespace Bar { op two(): void; namespace Qux { op three(): void; } } } ``` We will have 4 clients. The hierarchy looks like this: ``` ServiceClient - Foo - Bar - Qux ``` As a subclient, for instance, their full name could be `ServiceClient.Foo.Bar` in this case. Those second level (or deeper) subclients have a chance to have name collisions because we would put them in the same namespace previously, and we could have another subclient like `ServiceClient.Foo2.Bar`. Therefore previously we are making name changes to them automatically for those 2nd-level or deeper subclients by prepending all their parents' name to it. Now in this PR, it is not the goal here that we change that rule - this PR just wants them all to unchange - therefore I put this logic at the place that we have serialized the whole namespace to keep things in parity.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5924
Going forward to the ultimate goal of "only keep minimum code in our emitter, which should only parse and spit out the data from TCGC", this PR removes a few unnecessary code in our emitter, and align the structure of client in our emitter with the client from TCGC.
Client initialization stuff has not been started therefore I still keep the property
parameters
on the client type to keep maximum compatibility and minimum the code change. I think theparameters
could be gone once our client initialization work item was done.Operation stuff is also not changed, because the way TCGC represent operations/methods is different from ours. I also keep that part as a future work to align.
About client names:
Before, we did client name calculations in the emitter, to assign verbose name to subclients, such as:
We will have 4 clients. The hierarchy looks like this:
As a subclient, for instance, their full name could be
ServiceClient.Foo.Bar
in this case.Those second level (or deeper) subclients have a chance to have name collisions because we would put them in the same namespace previously, and we could have another subclient like
ServiceClient.Foo2.Bar
.Therefore previously we are making name changes to them automatically for those 2nd-level or deeper subclients by prepending all their parents' name to it.
Now in this PR, it is not the goal here that we change that rule - this PR just wants them all to unchange - therefore I put this logic at the place that we have serialized the whole namespace to keep things in parity.