-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
SingleRequestParameter setter parameter construction #20679
base: master
Are you sure you want to change the base?
SingleRequestParameter setter parameter construction #20679
Conversation
thanks for the PR also cc @cchacin |
@Mattias-Sehlstedt can you please review the CI failure when you've time? |
@@ -229,6 +228,21 @@ public FakeHttpSignatureTestRequest header1(String header1) { | |||
return this; | |||
} | |||
|
|||
@Override | |||
public boolean equals(Object o) { |
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.
Just copying the pojo implementation obviously doesn't get the job done properly. Will investigate if I am able to adjust it or if I will drop equals/hashcode entirely.
I assume the change is to replace Vars
with Params
in the mustache. But I am not sure what extension settings that would be relevant.
LGTM 👍 |
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.
With both webclient and restclient, when using the new option useSingleRequestParameter=static
the generated code doesn't compile. Please fix.
fix #20668
Introduces so that the argument class which is generated for
useSingleRequestParameter
can be constructed similar to the POJO models. The implementation uses the new (but yet to be released) "static" setting to further expand on the behavior ofuseSingleRequestParameter
.I have realize this behavior with mustache configuration rather than lombok to make it easier to make the behavior even more similar to that of POJOs in the future (e.g., sort parameters so required ones are highlighed in some sense, adding nullable annotations to class fields to highlight/trigger runtime errors when they are required).
A single lombok annotation is used to provide. I will investigate how to add an equals implementation as a separate issue.equals
to the class, to facilitate easier testing when working with mocks and verifying themThe current implementation for
useSingleRequestParameter
uses a record for RestClient, and a class for WebClient. In order to bring these SpringClients closer to each other, I have made it so that the RestClient will switch to also using a class when "static" is provided (but retain a record for "true" as to not make a breaking change).A better description than
..., but also makes the generated arguments class static with single parameter instantiation
can probably be made.cc @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) @martin-mfg (2023/08)
Edit notes: clarified that I will omit the equals implementation and instead do it separately so I can have time to investigate how to properly express it with mustache syntax.
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming7.x.0
minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)