Skip to content

When using the auto-schema-registry, the nullable field did not actually register as nullable there #88

Closed Answered by dstelljes
lixiandai asked this question in Q&A
Discussion options

You must be logged in to vote

Your .avsc file won't have any effect in that situation, since the schema that Chr.Avro.Confluent registers is generated by reflecting your .NET types. If you want to use the contents of the .avsc file instead of a generated schema, don't use auto registration; instead, read the file and use the Schema Registry client to register it.

Alternatively, if you want Chr.Avro to use .NET's nullable semantics (i.e., any reference types can have a null value) when generating schemas, you can provide a custom schema builder:

using Chr.Avro.Abstract;
using Chr.Avro.Confluent;
using Chr.Avro.Resolution;
using Confluent.Kafka;
using Confluent.SchemaRegistry;

var registry = new CachedSchemaRegistryClient

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dstelljes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #88 on December 09, 2020 13:39.