-
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, path allowReserved #2904
tsp, path allowReserved #2904
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,6 +118,7 @@ import { | |
getHeaderFieldName, | ||
getHeaderFieldOptions, | ||
getPathParamName, | ||
getPathParamOptions, | ||
getQueryParamName, | ||
getQueryParamOptions, | ||
getServers, | ||
|
@@ -306,6 +307,7 @@ export class CodeModelBuilder { | |
}, | ||
}, | ||
extensions: { | ||
// TODO: deprecate this logic of string/url for x-ms-skip-url-encoding | ||
"x-ms-skip-url-encoding": schema instanceof UriSchema, | ||
}, | ||
// // make the logic same as TCGC, which takes the server-side default of host as client-side default | ||
|
@@ -1072,14 +1074,23 @@ export class CodeModelBuilder { | |
schema = this.processSchemaFromSdkType(sdkType, param.param.name); | ||
} | ||
|
||
// skip-url-encoding | ||
let extensions: { [id: string]: any } | undefined = undefined; | ||
// skip-url-encoding | ||
if (param.type === "path") { | ||
const pathParamOptions = getPathParamOptions(this.program, param.param); | ||
if (pathParamOptions.allowReserved) { | ||
extensions = extensions ?? {}; | ||
extensions["x-ms-skip-url-encoding"] = true; | ||
} | ||
} | ||
// TODO: deprecate this logic of string/url for x-ms-skip-url-encoding | ||
if ( | ||
(param.type === "query" || param.type === "path") && | ||
param.param.type.kind === "Scalar" && | ||
schema instanceof UriSchema | ||
) { | ||
extensions = { "x-ms-skip-url-encoding": true }; | ||
extensions = extensions ?? {}; | ||
extensions["x-ms-skip-url-encoding"] = true; | ||
} | ||
Comment on lines
+1079
to
1087
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't deprecate the old logic of Plan to check later. Let's have support for It should be OK to drop such logic in TCGC SdkPackage migration. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, TCGC should handle it and returns correct collection format. I am integrating with latest TCGC. I will pay attention to the test case. |
||
|
||
if (this.supportsAdvancedVersioning()) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,8 +59,8 @@ namespace Cadl.ContosoServer { | |
name: "Contoso.Sub.ContosoClient", | ||
service: Cadl.ContosoServer, | ||
}) | ||
@route("/contoso/{group}") | ||
@route("/contoso/") | ||
interface ServerOp { | ||
get(@path group: url): OkResponse | NoContentResponse; | ||
get(@path(#{ allowReserved: true }) group: string): OkResponse | NoContentResponse; | ||
} | ||
Comment on lines
-62
to
65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 0.59.0 requires either way
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to add another test case using URI template? ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Timothee is adding a cadl-ranch test. My local test, that Same effect on playground (Swagger having There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, it need to be (no
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This appears to be a bug in http lib. microsoft/typespec#4132 The Therefore I switched to |
||
} |
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.
tsp-client 0.19.0