FasterXML / FasterXML/jackson-dataformats-binary

[avro] Add support for external nullability annotations (JSpecify?)

未關閉
#147 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
avro
主要語言
Java
星號
347
分支
156
平均合併
3 天 3 小時
30 天內合併 PR
22

描述

If I have a simple class

```
public class Foo {
private final String value;

public Foo(String aValue) {
value = aValue;
}

public String getValue() {
return value;
}
}
```
and generate a schema with:

```
import com.fasterxml.jackson.dataformat.avro.AvroMapper;
import com.fasterxml.jackson.dataformat.avro.AvroSchema;

import java.io.IOException;

public class Main {
public static void main(String[] args) throws IOException {
AvroSchema myAvroSchema = new AvroMapper().schemaFor(Foo.class);
System.out.println(myAvroSchema.getAvroSchema().toString(true));
}
}
```

I get:

```
{
"type" : "record",
"name" : "Foo",
"fields" : [ {
"name" : "value",
"type" : [ "null", "string" ]
} ]
}
```

Primitive fields are not marked nullable. No `@NotNull` or `@Nonnull` annotation seems to change the generated schema to have non-null fields. Am I doing something wrong?

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。