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
Adding setters or making them public in ActionRequests #8123
Adding setters or making them public in ActionRequests #8123
Conversation
MoreLikeThisRequest, AnalyzeRequest, and DeleteIndexTemplateRequest (and associated builders) all prevented some fields from being set outside their constructor. This makes those fields _publically_ settable, which helps to simplify usage in other languages like Groovy.
Although helps to simplify things in languages like groovy I am concerned about the impact it has on the Java API. I would assume that the reason these fields are explicitly prevented from being set outside the constructor is that they are required parameters (e.g. you must specify the name of the template you want to delete). By making them optional in the Java API we increase the risk that someone will accidentally not set it causing a headache for the user. Furthermore, since this fields have always been guaranteed to be set I would be wary of unknown side-effects if the request did get made with those fields set to null. The code may not guard against these fields being null, at best this would result in a NPE, at worst the null could be interpreted as all and have serious side-effects. |
@colings86 I think that they were overlooked because it was already added to the Validation API. Honestly, it should just fail at the constructor rather than being a surprise later if we don't change it. Except |
I think all of the requests should ideally do validation using the |
Do you have time to address my comments @pickypg ? Let me know if you have any question. |
I pushed a fix for this: note that the more like this api is gone in master, thus no need to modify anything there. |
MoreLikeThisRequest, AnalyzeRequest, and DeleteIndexTemplateRequest (and associated builders) all prevented some fields from being set outside their constructor. This makes those fields publically settable, which helps to simplify usage in other languages like Groovy.
Closes #8122