-
Notifications
You must be signed in to change notification settings - Fork 183
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
Generate hashCode and equals #1201
Generate hashCode and equals #1201
Conversation
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
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.
@miguel-vila This is really cool to see, thank you for picking this up!
Have added a few comments.
...degen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache
Outdated
Show resolved
Hide resolved
...gen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache
Outdated
Show resolved
Hide resolved
...gen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache
Show resolved
Hide resolved
...degen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache
Outdated
Show resolved
Hide resolved
Co-authored-by: Thomas Farr <xtansia@xtansia.com> Signed-off-by: Miguel Vilá <miguelvilag@gmail.com>
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
@Xtansia I have addressed most of your comments, the remaining one is regarding using an import instead of the fqn for I'm also interested in these changes because I want to have these methods in classes like |
...degen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache
Outdated
Show resolved
Hide resolved
...degen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache
Outdated
Show resolved
Hide resolved
@miguel-vila Yeah, we're currently doing a bit of a piecemeal approach to get things to be generated. It's somewhat slow going as when we do generate new sections there are breaking changes and other differences with the current client implementation, which requires evaluating between the client, the spec & the server what the correct expectation is. So for some of the more complex structures it might be faster/easier to add them to your required types by hand. However if you're interested in helping out with moving even 1 or 2 requests to be generated that would be amazing. |
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
Signed-off-by: miguel-vila <miguelvilag@gmail.com>
@Xtansia I would prefer not to add those manually, but not sure what would be the changes needed to include them in the codegeneration. Locally, I modified the
Is it possible that these errors would require more changes than adding the methods manually? |
There's likely more edge cases that'll pop up with something as expansive as |
* Generate hashCode and equals , wip Signed-off-by: miguel-vila <miguelvilag@gmail.com> * add changelog entry Signed-off-by: miguel-vila <miguelvilag@gmail.com> * remove change Signed-off-by: miguel-vila <miguelvilag@gmail.com> * take into account primitives Signed-off-by: miguel-vila <miguelvilag@gmail.com> * refactor and format Signed-off-by: miguel-vila <miguelvilag@gmail.com> * use Object.equals Co-authored-by: Thomas Farr <xtansia@xtansia.com> Signed-off-by: Miguel Vilá <miguelvilag@gmail.com> * use `&&` chain Signed-off-by: miguel-vila <miguelvilag@gmail.com> * adjust last line Signed-off-by: miguel-vila <miguelvilag@gmail.com> * use fqn Signed-off-by: miguel-vila <miguelvilag@gmail.com> * use fqn for Objects.hashCode, take into account parent Signed-off-by: miguel-vila <miguelvilag@gmail.com> * remove unused var definition Signed-off-by: miguel-vila <miguelvilag@gmail.com> * codegen equals/hashCode for request shapes Signed-off-by: miguel-vila <miguelvilag@gmail.com> * add hashCode/equals to TaggedUnion Signed-off-by: miguel-vila <miguelvilag@gmail.com> * use import Signed-off-by: miguel-vila <miguelvilag@gmail.com> * fix equals for request shapes Signed-off-by: miguel-vila <miguelvilag@gmail.com> * codegen latest from main Signed-off-by: miguel-vila <miguelvilag@gmail.com> --------- Signed-off-by: miguel-vila <miguelvilag@gmail.com> Signed-off-by: Miguel Vilá <miguelvilag@gmail.com> Co-authored-by: Thomas Farr <xtansia@xtansia.com> (cherry picked from commit 18a8460)
* Generate hashCode and equals , wip Signed-off-by: miguel-vila <miguelvilag@gmail.com> * add changelog entry Signed-off-by: miguel-vila <miguelvilag@gmail.com> * remove change Signed-off-by: miguel-vila <miguelvilag@gmail.com> * take into account primitives Signed-off-by: miguel-vila <miguelvilag@gmail.com> * refactor and format Signed-off-by: miguel-vila <miguelvilag@gmail.com> * use Object.equals Co-authored-by: Thomas Farr <xtansia@xtansia.com> Signed-off-by: Miguel Vilá <miguelvilag@gmail.com> * use `&&` chain Signed-off-by: miguel-vila <miguelvilag@gmail.com> * adjust last line Signed-off-by: miguel-vila <miguelvilag@gmail.com> * use fqn Signed-off-by: miguel-vila <miguelvilag@gmail.com> * use fqn for Objects.hashCode, take into account parent Signed-off-by: miguel-vila <miguelvilag@gmail.com> * remove unused var definition Signed-off-by: miguel-vila <miguelvilag@gmail.com> * codegen equals/hashCode for request shapes Signed-off-by: miguel-vila <miguelvilag@gmail.com> * add hashCode/equals to TaggedUnion Signed-off-by: miguel-vila <miguelvilag@gmail.com> * use import Signed-off-by: miguel-vila <miguelvilag@gmail.com> * fix equals for request shapes Signed-off-by: miguel-vila <miguelvilag@gmail.com> * codegen latest from main Signed-off-by: miguel-vila <miguelvilag@gmail.com> --------- Signed-off-by: miguel-vila <miguelvilag@gmail.com> Signed-off-by: Miguel Vilá <miguelvilag@gmail.com> Co-authored-by: Thomas Farr <xtansia@xtansia.com> Signed-off-by: Thomas Farr <tsfarr@amazon.com> (cherry picked from commit 18a8460)
* Generate hashCode and equals (#1201) * Generate hashCode and equals , wip Signed-off-by: miguel-vila <miguelvilag@gmail.com> * add changelog entry Signed-off-by: miguel-vila <miguelvilag@gmail.com> * remove change Signed-off-by: miguel-vila <miguelvilag@gmail.com> * take into account primitives Signed-off-by: miguel-vila <miguelvilag@gmail.com> * refactor and format Signed-off-by: miguel-vila <miguelvilag@gmail.com> * use Object.equals Co-authored-by: Thomas Farr <xtansia@xtansia.com> Signed-off-by: Miguel Vilá <miguelvilag@gmail.com> * use `&&` chain Signed-off-by: miguel-vila <miguelvilag@gmail.com> * adjust last line Signed-off-by: miguel-vila <miguelvilag@gmail.com> * use fqn Signed-off-by: miguel-vila <miguelvilag@gmail.com> * use fqn for Objects.hashCode, take into account parent Signed-off-by: miguel-vila <miguelvilag@gmail.com> * remove unused var definition Signed-off-by: miguel-vila <miguelvilag@gmail.com> * codegen equals/hashCode for request shapes Signed-off-by: miguel-vila <miguelvilag@gmail.com> * add hashCode/equals to TaggedUnion Signed-off-by: miguel-vila <miguelvilag@gmail.com> * use import Signed-off-by: miguel-vila <miguelvilag@gmail.com> * fix equals for request shapes Signed-off-by: miguel-vila <miguelvilag@gmail.com> * codegen latest from main Signed-off-by: miguel-vila <miguelvilag@gmail.com> --------- Signed-off-by: miguel-vila <miguelvilag@gmail.com> Signed-off-by: Miguel Vilá <miguelvilag@gmail.com> Co-authored-by: Thomas Farr <xtansia@xtansia.com> Signed-off-by: Thomas Farr <tsfarr@amazon.com> (cherry picked from commit 18a8460) * Re-run codegen (#1216) * Re-run codegen Signed-off-by: Thomas Farr <tsfarr@amazon.com> * Improve null handling Signed-off-by: Thomas Farr <tsfarr@amazon.com> --------- Signed-off-by: Thomas Farr <tsfarr@amazon.com> (cherry picked from commit 897cc9b)
Description
Generate
hashCode
andequals
methods.Issues Resolved
#312