for example I have a field like ``` { ...
# announcements
a
for example I have a field like
Copy code
{
        "name": "parameters",
        "type": [
          "null",
          {
            "type": "array",
            "items": "Parameter"
          }
        ],
        "default": null
so it can have a null value but the avro generator generates a java getter like this
Copy code
public java.util.List<Parameter> getParameters() {
    return parameters;
}
my problem is that when calling getParameters that returns null I get
Copy code
java.lang.IllegalStateException: order.getParameters() must not be null
b
The nullability interop with Kotlin is acheived using the
@Nullable
annotation. Is there a way for Avro to apply that?
a
@Barco I haven't found any reference to that
for now I'm using
order.getParameters() as List<Type>?
and it's working fine but I have to repeat that every time I call the function
b
a
We're using avsc files unfortunately not java 😕 I'll check however if there's a way to do so in the avsc file, seems setting default as null and type as nullable with the union syntax is enough
thank you very much 🙂
👍 1
also in that description:
Causes an Avro union with null to be used
which is the same exact thing so probably it wouldn't work anyway
i
I found something like https://github.com/sksamuel/avro4k