Is your feature request related to a problem? Please describe 🙏
We have a nullable attribute that we wish to write to an Algolia index. Our code must use partialUpdateObjects. We need a way to delete an attribute or set its value to null. Unfortunately, the current version of the library (v2.1.5) does not provide a way to create a Partial.Update object with a null value.
val value: String? = null
// Type mismatch: required String, found String?.
val update1 = Partial.Update(Attribute("attr1"), value)
// None of the following functions can be called with the arguments supplied.
// <init>(Attribute, Boolean) defined in com.algolia.search.model.indexing.Partial.Update
// <init>(Attribute, Number) defined in com.algolia.search.model.indexing.Partial.Update
// <init>(Attribute, String) defined in com.algolia.search.model.indexing.Partial.Update
// <init>(Attribute, JsonArray) defined in com.algolia.search.model.indexing.Partial.Update
// <init>(Attribute, JsonObject) defined in com.algolia.search.model.indexing.Partial.Update
val update2 = Partial.Update(Attribute("attr1"), null)
Describe the solution you'd like 🤔
Add constructors:
public constructor(attribute: Attribute, value: JsonNull)
public constructor(attribute: Attribute, value: String?)
public constructor(attribute: Attribute, value: Boolean?)
public constructor(attribute: Attribute, value: Number?)
public constructor(attribute: Attribute, value: JsonArray?)
public constructor(attribute: Attribute, value: JsonObject?)
Describe alternatives you've considered ✨
I considered writing an empty string. This will require extra work to change the code that reads the index.
Is your feature request related to a problem? Please describe 🙏 We have a nullable attribute that we wish to write to an Algolia index. Our code must use
partialUpdateObjects
. We need a way to delete an attribute or set its value tonull
. Unfortunately, the current version of the library (v2.1.5) does not provide a way to create aPartial.Update
object with anull
value.Describe the solution you'd like 🤔 Add constructors:
Describe alternatives you've considered ✨ I considered writing an empty string. This will require extra work to change the code that reads the index.
Additional context