-
Notifications
You must be signed in to change notification settings - Fork 230
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
[http-client-csharp]: Fix explode not being properly set for operation params #5396
base: main
Are you sure you want to change the base?
[http-client-csharp]: Fix explode not being properly set for operation params #5396
Conversation
API change check API changes are not detected in this pull request. |
06693ea
to
d668b75
Compare
d668b75
to
075c152
Compare
packages/http-client-csharp/emitter/src/lib/operation-converter.ts
Outdated
Show resolved
Hide resolved
packages/http-client-csharp/emitter/src/lib/operation-converter.ts
Outdated
Show resolved
Hide resolved
packages/http-client-csharp/emitter/src/lib/operation-converter.ts
Outdated
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.
In general, our definition of the parameter is quite cumbersome - all the parameters are sharing the same InputParameter
model.
We should follow the definition of TCGC (they have discriminated models for each type of parameters) - @m_nash had the vision that our emitter should just redirect the data from TCGC therefore aligning their models on our side should be the first step.
But changing it is extremely complicated and we do not have to do it in this PR.
If you have further questions on how explode works, I think you could offline chat with @tadelesh
…-param-explode
…-param-explode
…-param-explode
…-param-explode
packages/http-client-csharp/emitter/src/lib/operation-converter.ts
Outdated
Show resolved
Hide resolved
@@ -421,3 +426,7 @@ function normalizeHeaderName(name: string): string { | |||
return name; | |||
} | |||
} | |||
|
|||
function isExplodedParameter(p: SdkHttpParameter): boolean { | |||
return (p.kind === "path" || p.kind === "query") && p.explode === true; |
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 we not care about the multi
format anymore? I'm curious why we can't just use p.explode.
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 removed the multi check based on this feedback. The explode
property only exists for these interfaces SdkQueryParameter
and SdkPathParameter
so we still need a check to see if the parameter type implements either to reference that property. At least that is my rusty understanding 😃
@@ -187,6 +187,11 @@ function fromSdkHttpOperationParameter( | |||
const format = p.kind === "header" || p.kind === "query" ? p.collectionFormat : undefined; | |||
const serializedName = p.kind !== "body" ? p.serializedName : p.name; | |||
|
|||
// TO-DO: In addition to checking if a path parameter is exploded, we should consider capturing the style for |
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.
Can you clarify what is meant by "style"? Also, can we file an issue for this?
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.
Sure I'm referring to the delimiter. I've updated the comment accordingly. Here is a chart for reference of what's supported through uri templates. I have also filed #5561 to track this.
This PR fixes an issue where the
explode
flag for a operation parameter was not being properly set when uri templates were specified. This is fixed now by passing through the value ofexplode
from TCGC.There are several follow ups that are still needed to fully support URI templates and path expansion.
fixes: #5134
regen preview for autorest: Azure/azure-sdk-for-net#47775