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
|
All changed packages have 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 report✅ No notable package size changes compared to the base branch. 13 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?
fixes #3542