feat(tcgc): support overriding method responses - #5173
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8aca8827-bea2-4bf5-ae80-c87bebeedcbd
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8aca8827-bea2-4bf5-ae80-c87bebeedcbd
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8aca8827-bea2-4bf5-ae80-c87bebeedcbd
|
❌ There is undocummented changes. Run The following packages have changes but are not documented.
The following packages have already been documented:
Show changes
|
commit: |
|
You can try these changes here
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8aca8827-bea2-4bf5-ae80-c87bebeedcbd
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8aca8827-bea2-4bf5-ae80-c87bebeedcbd
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 8aca8827-bea2-4bf5-ae80-c87bebeedcbd
📦 Package size report4 packages changed size, +10.55 KB (+0.1%) packed overall.
9 package(s) with no notable change
Packed = gzipped |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 8aca8827-bea2-4bf5-ae80-c87bebeedcbd
| name: string; | ||
| } | ||
|
|
||
| @post op create(): Widget | Error; |
There was a problem hiding this comment.
Java does not support union of 2 unrelated models...
| op customizedCreate(): DeleteResult; | ||
| @@override(TestService.create, TestService.customizedCreate); |
There was a problem hiding this comment.
Why is this allowed?
|
|
||
| const baseServiceMethod = diagnostics.pipe( | ||
| getSdkBasicServiceMethod<TServiceOperation>(context, operation, client), | ||
| getSdkBasicServiceMethod<TServiceOperation>(context, operation, client, false), |
There was a problem hiding this comment.
Why here we pass false? This flag looks quick hacky to me.
|
|
||
| @post op create(): Widget; | ||
|
|
||
| op customizedCreate(): DeleteResult; |
There was a problem hiding this comment.
Please pay attention to the usage and serialization info of new response model.
There was a problem hiding this comment.
as well as the usage for original model.
| * ``` | ||
| */ | ||
| #suppress "experimental-feature" "replaceResponse uses extern fn which is experimental but provides essential response transformation functionality" | ||
| extern fn replaceResponse(operation: Reflection.Operation, response: unknown): Reflection.Operation; |
There was a problem hiding this comment.
When we replace the response, how could we know how to map the method level response to the HTTP level response?
Re-applies the fix reverted in 35b427d. Verified this duplicate-body failure is introduced by this PR's pageable/response-override classification changes (confirmed clean compile on main, failing on this branch), not a pre-existing Java fixture bug, so the fix belongs here. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8aca8827-bea2-4bf5-ae80-c87bebeedcbd
| op groupExcludeBodyCustomization( | ||
| ...TspTest.MethodOverride.GroupExcludeBody, | ||
| options?: TspTest.MethodOverride.GroupQueryOptions, | ||
| @query options?: TspTest.MethodOverride.GroupQueryOptions, |
There was a problem hiding this comment.
Emm, I am OK if this is only to unblock. But unsure why? What if we group query and header parameter in the model?
fixes #3542