You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We’re hoping to ship support for nullable reference types with 8.0.0 soon (see #102). Currently, it’s all-or-nothing—you can set the resolver to follow .NET’s nullable semantics...
usingChr.Avro.Abstract;usingChr.Avro.Confluent;usingChr.Avro.Resolution;usingConfluent.Kafka;usingConfluent.SchemaRegistry;varregistry=newCachedSchemaRegistryClient(newSchemaRegistryConfig{ ...});vartypeResolver=newReflectionResolver(resolveReferenceTypesAsNullable:true// schema builder will produce ["null", ...] for all reference types);varschemaBuilder=newSchemaBuilder(typeResolver:typeResolver);varserializerBuilder=newSchemaRegistrySerializerBuilder(registry,schemaBuilder:schemaBuilder)varproducerBuilder=newProducerBuilder<Ignore,SomeValue>();awaitbuilder.SetAvroValueSerializer(serializerBuilder,"test-subject",registerAutomatically:AutomaticRegistrationBehavior.Always);
... but there isn’t a way to pick and choose fields short of modifying the abstract schema.
It’d be nice to support [IsRequired] as well. I’m leery of possible contradictions with nullable types (e.g. https://stackoverflow.com/a/7767083), but I think they can both be implemented with an IsNullable property on FieldResolution.
Hi, me again with another question.
Is it possible to enforce nullability in schema of reference types?
This is our contract in code:
Schema registered in registry:
I was trying to use
IsRequired
but it didn't change anything (as expected after reading its documentation ;)).What we would like to achieve is:
I'd like to help with implementing it - if you want help of course. Just let me know if that is possible or not because you'll probably know :)
The text was updated successfully, but these errors were encountered: