-
Notifications
You must be signed in to change notification settings - Fork 45
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
[TCGC] Could TCGC provide an easier way to map from SdkMethodParameter
to SdkPathParameter | SdkQueryParameter | SdkHeaderParameter | SdkBodyParameter
?
#1441
Comments
SdkMethodParameter
to SdkPathParameter | SdkQueryParameter | SdkHeaderParameter | SdkBodyParameter
?SdkMethodParameter
to SdkPathParameter | SdkQueryParameter | SdkHeaderParameter | SdkBodyParameter
?
this issue is raising the same concern that this previous issue raised. Currently the design is that the method signature is agnostic of the protocol and serialized information, but I think we can revisit this during our scrum talk and see what new thoughts are. We're in a weird spot right now, where I feel we want to move more towards what's directly in the typespec, but we are still modifying the method signature based off of HTTP-specific info. I think it would be good to revisit this as well during out discussions later today, to see if we can get more consistency here. |
Thanks @iscai-msft for the reply. Yeah, I know this issue and I totally understand the TCGC design is |
Summarize on 8/29 discussion:
Personally I prefer option 2 together with option 3, we can first provide option 2, and do the enhancement/enrichment in option 3 together. |
I agree with your summary @haolingdong-msft thank you so much! To me, 1 and 2 are about the same, but it makes sense to expose it as a helper function since not all of us need it |
@iscai-msft we also need the mapping between /cc @tadelesh |
SdkMethodParameter
to SdkPathParameter | SdkQueryParameter | SdkHeaderParameter | SdkBodyParameter
?SdkMethodParameter
to SdkPathParameter | SdkQueryParameter | SdkHeaderParameter | SdkBodyParameter
?
Have another issue in filtering cookie parameter in the method level Azure/autorest.typescript#2943 (comment) which could benefit from here if we could have the link from SdkMethodParameter to SdkHttpParameter. |
Example:
TSP:
Generated java sdk:
code-model:
TCGC response:
SdkServiceMethod
'sfile_data
parameterSdkHttpOperation
'sbodyParameter
parameterIt is recommended to generate sdk's convenient method using
SdkServiceMethod
, but currentSdkServiceMethod.SdkMethodParameter
is lack of information related with body/header/query/path parameters, when you get aSdkMethodParameter
, you don't know if it's body/header/query/path parameters. But the convenient method could depend on those information. e.g.bytes
provided bySdkMethodParameter
) for the method signature and have additional handling in convenient method impl before calling protocol API;accept
andcontent-type
headers will not be added to convenient method signature;And for Java, you can see we use M4 code-model as intermediate output,
ConvenientApi.parameters
contain information likehttp.in
. All those information are underSdkPathParameter | SdkQueryParameter | SdkHeaderParameter | SdkBodyParameter
ofSdkHttpOperation
. So we need to mapSdkMethodParameter
toSdkPathParameter | SdkQueryParameter | SdkHeaderParameter | SdkBodyParameter
to get more information to generate convenient method.One thing I found inconvenient is current TCGC only contains mapping from
SdkPathParameter | SdkQueryParameter | SdkHeaderParameter | SdkBodyParameter
toSdkMethodParameter
, I wonder if TCGC could provide a helper function or properties onSdkMethodParameter
to let emitter mapSdkMethodParameter
toSdkPathParameter | SdkQueryParameter | SdkHeaderParameter | SdkBodyParameter
?@iscai-msft , @tadelesh , what do you think?
The text was updated successfully, but these errors were encountered: