FasterXML / FasterXML/jackson-dataformats-binary

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

Đang mở
#147 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
avro
Ngôn ngữ chính
Java
Star
347
Fork
156
Merge trung bình
3 ngày 3 giờ
Pull request đã merge (30 ngày)
22

Mô tả

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?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.