-
Notifications
You must be signed in to change notification settings - Fork 283
http-client-java, codegen change, support query param reinjection #7668
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
base: main
Are you sure you want to change the base?
http-client-java, codegen change, support query param reinjection #7668
Conversation
No changes needing a change description found. |
You can try these changes here
|
@@ -40,6 +40,7 @@ final class PagingMetadata { | |||
private final List<ClientMethod> nextMethods; | |||
private final ClientMethodParameter maxPageSizeParameter; | |||
private final MethodPageDetails.ContinuationToken continuationToken; | |||
private final List<String> nextLinkReInjectedParameterNames; |
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 it be in a class e.g. NextLinkReInjection
(similar to ContinuationToken
)?
As this is a legacy feature, we'd like it to be in its place.
And test would be simplify whether this var is null or not -- List be empty should also mean this var be null.
nit, if only query param is valid, make it in the name of the list (or at least document it).
if (p.getLanguage() != null && p.getLanguage().getDefault() != null) { | ||
nextLinkReInjectedParameterNames.add(p.getLanguage().getDefault().getName()); | ||
} |
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.
It should be serializedName
?
If so, also say it in the name of the List.
@@ -1069,6 +1083,28 @@ private static void addServiceMethodAnnotation(JavaType typeBlock, ReturnType re | |||
typeBlock.annotation("ServiceMethod(returns = ReturnType." + returnType.name() + ")"); | |||
} | |||
|
|||
private static void addQueryParameterReInjectionLogic(List<String> reinjectedParamNames, JavaBlock javaBlock) { |
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.
Code would be different in clientcore/v2.
If there is subclass for this Template class, use protected + override in its subclass.
If not, use a condition.
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.
Yes, clientcore is different, I will change to protected and use override method. Do you think we need to support this feature in clientcore template? I tend to have empty override function in client core template because this feature is for azure only, and currently all azure sdks are using azure core, not client core.
Fix Azure/autorest.java#3081
Design:
Azure/autorest.java#3081 (comment)
Code change:
nextLinkReInjectedParameterNames
property and logics to extract the value fromxmsPageable
and put toMethodPageDetails
.nextLinkReInjectedParameterNames
property and corresponding ctor, getters.addQueryParameterReInjectionLogic
and apply to both sync and async paging service client method.