Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nullable reference type support to schema builder #184

Merged
merged 3 commits into from
Feb 11, 2022

Conversation

dstelljes
Copy link
Member

This change enables the schema builder to analyze nullable reference type annotations when configured with the NullableReferenceTypeBehavior.Annotated option. Per #102, it also makes Annotated the default behavior as it matches the current default behavior (None) for oblivious types and transparently enables better schema generation for non-oblivious types.

.NET 6 introduces new reflection APIs to support reading metadata. Since dropping support for everything below .NET 6 isn’t an option and reimplementing the parsing logic would be non-trivial, I opted to copy over the implementations to the base library’s internal infrastructure namespace. This is basically what every shim library (e.g. Nullability.Source) does as well.

The --nullable-references flag on dotnet avro create is changed from a boolean to an enum to support the annotated option, which becomes the default. The --nullable-references flag on dotnet avro generate is new, and for now it’s off by default.

@dstelljes dstelljes force-pushed the feature/nullable-reference-types branch from 59bed07 to 88596cb Compare February 10, 2022 22:05
@dstelljes dstelljes merged commit 246f0ca into 8.x Feb 11, 2022
@dstelljes dstelljes deleted the feature/nullable-reference-types branch February 11, 2022 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant