elastic/elasticsearch-java

DisableUserResponse._DESERIALIZER should use emptyObject, not fixedValue

henryptung opened this issue · 6 comments

Java API client version

8.11.1

Java version

17

Elasticsearch Version

8.11.1

Problem description

The disable user endpoint actually returns an empty object, given server-side code here https://github.com/elastic/elasticsearch/blob/21f059166458978a5f3289686f1d218f0814c4ff/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestSetEnabledAction.java#L74.

However, the Java client uses JsonpDeserializer.fixedValue(T) here, which expects no JSON content at all (i.e. accepts no JSON events at all). Rather, it should be using JsonpDeserializer.emptyObject(T), which expects/consumes an empty object and then returns the singleton result value.

Note: Think the same applies to EnableUserResponse and ChangePasswordResponse. Not sure why SimulateIndexTemplateResponse is using .fixedValue, given the server-side SimulateIndexTemplateResponse actually contains JSON content/data, but fairly confident all uses of JsonpDeserializer.fixedValue are suspect.