-
Notifications
You must be signed in to change notification settings - Fork 82
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
tsp, handle spread behavior change from TCGC #2934
Conversation
3ca5884
to
e74fadc
Compare
// 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(); |
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.
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
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/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
if (operationIsJsonMergePatch(sdkHttpOperation)) { | ||
// skip model flatten, if "application/merge-patch+json" | ||
schema.language.default.name = pascalCase(op.language.default.name) + "PatchRequest"; | ||
return; | ||
} |
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.
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
I will merge the PR after Haoling done the release and sync of 0.20.0 |
publishing to npm, I will notify here once I triggered sync sdk pipeline on main so that you can merge the pr. |
Hi @weidongxu-microsoft, I have triggered sync sdk pipeline on main branch. |
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