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

[REQ] [java] [restclient] [webclient] Equals and hashcode implementation for static singleRequestParameter model #20829

Open
Mattias-Sehlstedt opened this issue Mar 8, 2025 · 0 comments · May be fixed by #20833

Comments

@Mattias-Sehlstedt
Copy link
Contributor

Is your feature request related to a problem? Please describe.

The class that is generated when using the "useSingleRequestParameter" option with static for the Java Spring-client could preferably have an implementation for equals and hashcode so the model is easier to use.

For example in a testing context with Mockito where the service is instantiating the class with a number of parameters and the mock is then ensuring that the apiClient is invoked with the correct "EXPECTED_PARAMETER" instance.

int param1 = 1;
int param2 = 2;
SingleRequestParam EXPECTED = new SingleRequestParam().param1(param1).param2(param2);    

@Test
void test() {
    service.call(param1, param2);

    verify(apiClient, times(1)).call(EXPECTED);
}

Describe the solution you'd like

The class defines an equals and a hashcode that compares the values of the variables of the class.

Describe alternatives you've considered

Letting the openapi-generator user define it themselves (e.g., either by overriding the implementation themselves, or by using lombok or similar).

Additional context

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

Successfully merging a pull request may close this issue.

1 participant