tsp, handle spread behavior change from TCGC#2934
Merged
weidongxu-microsoft merged 9 commits intomainfrom Aug 28, 2024
Merged
Conversation
3ca5884 to
e74fadc
Compare
Comment on lines
1319
to
1326
| // Implicit body parameter would have usage flag: UsageFlags.Spread, for this case we need to do body parameter flatten | ||
| const bodyParameterFlatten = sdkType.kind === "model" && sdkType.usage & UsageFlags.Spread && !this.isArm(); | ||
| // Explicit body parameter @body or @bodyRoot would result to the existance of rawHttpOperation.parameters.body.property | ||
| // Implicit body parameter would result to rawHttpOperation.parameters.body.property be undefined | ||
| // see https://typespec.io/docs/libraries/http/cheat-sheet#data-types | ||
| const bodyParameterFlatten = | ||
| sdkType.kind === "model" && !rawHttpOperation.parameters.body?.property && !this.isArm(); |
Member
Author
There was a problem hiding this comment.
flatten or not should not be based on the model, it should be based on the info of the client method (which is yet to be included in the migration).
cfee1ae to
b70eb68
Compare
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
b70eb68 to
7d91812
Compare
0ba777e to
ea94cb6
Compare
ea94cb6 to
be8c404
Compare
c650a1b to
0df9583
Compare
Comment on lines
-1334
to
-1338
| if (operationIsJsonMergePatch(sdkHttpOperation)) { | ||
| // skip model flatten, if "application/merge-patch+json" | ||
| schema.language.default.name = pascalCase(op.language.default.name) + "PatchRequest"; | ||
| return; | ||
| } |
Member
Author
There was a problem hiding this comment.
and
- schema.language.default.name = pascalCase(op.language.default.name) + "Request";These change does not relate to the issue.
But we should use name from TCGC in almost all cases.
This is the cause of the diff of generated code in this PR.
typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest9.java
Show resolved
Hide resolved
64d74ac to
9cbf0e7
Compare
haolingdong-msft
approved these changes
Aug 28, 2024
Member
Author
|
I will merge the PR after Haoling done the release and sync of 0.20.0 |
Member
|
publishing to npm, I will notify here once I triggered sync sdk pipeline on main so that you can merge the pr. |
Member
|
Hi @weidongxu-microsoft, I have triggered sync sdk pipeline on main branch. |
weidongxu-microsoft
added a commit
to weidongxu-microsoft/typespec
that referenced
this pull request
Aug 29, 2024
This file contains hidden or 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
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.
nightly dev passes
diff https://dev.azure.com/azure-sdk/public/_build/results?buildId=4083808&view=logs&j=ca395085-040a-526b-2ce8-bdc85f692774&t=8d0a7aee-8090-5653-72a7-7c81ab87cde7