Skip to content
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

Draft - Feature/equals hashcode in client generation #911

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

denvitaharen
Copy link
Contributor

This is an draft to discuss, its lacks test, the formatting is a bit off and can be made better, but its up for discussion.

I missed a generated equals and dashcode in my models, so I thought that I tried adding it. I think I got all cases checked, but before I add more time in this it should be discussed.

  1. Do we want this? Other Openapi client generators generates this (so it breaks stuff if we change to this generator)
  2. If we want it, should it always generate methods and not being able do disable? Or should you have to enable it? Or should it be enabled by default with possibility to disabled?

This is an example of how the generated method looks:

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Animal model = (Animal) o;

        return Objects.equals(born, model.born) &&
        Objects.equals(deceased, model.deceased);
    }

     @Override
     public int hashCode() {
         return Objects.hash(born,
         deceased);
     }

@denvitaharen
Copy link
Contributor Author

Sorry, I accidentally pushed an branch with commits from my last PR, its only this commits that's 447bb46

I will try and fix the branch tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant