-
Notifications
You must be signed in to change notification settings - Fork 75
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
Support @overload & @sharedRoute #1848
Conversation
id: string; | ||
} | ||
@route("/overload") | ||
interface OveralodOperations { |
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.
@joheredi Could you help review the overload cases and their generated code?
@@ -74,11 +75,15 @@ export function isDefinedStatusCode(statusCode: StatusCode) { | |||
return statusCode !== "*"; | |||
} | |||
|
|||
export function isBinaryPayload(body: Type, contentType: string) { | |||
export function isBinaryPayload( |
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.
Now that TypeSpec supports @encode I wonder if we can leverage it to get rid of this complex logic.
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.
https://github.com/Azure/autorest.typescript/blob/4d5f63021d4cad58d958eec6f674151d1f23d7b7/packages/typespec-ts/src/modelUtils.ts#L850-L860Currently we already have this implemented.
This check helps on binary body not byte in a normal model.
@overload(OveralodOperations.getThing) | ||
getString(@body param: string): string; | ||
|
||
@overload(OveralodOperations.getThing) |
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.
@m-nash, did we get to an agreement on how we'll do overloads? Does this align with that?
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.
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.
I moved the current overload cases to client.tsp. I notice that we have an issue https://github.com/Azure/typespec-azure/issues/2738 in Project TOM but not started yet.
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.
packages/typespec-ts/test/integration/generated/mediaTypes/tspconfig.yaml
Show resolved
Hide resolved
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.
Do you mentioned that you will use the autorest testserver to write test cases for media types ?
I re-organizated these test cases and their path can't be shared. |
fixes #1760 #1763
Leverage the TypeScript overload to support the decorators @SharedRoute and @overload.
Adding below test cases: