Hi,
At the moment when generating POCO classes with Avrogen it doesn't take default 
values for array type into account.
AVRO specs say it is allowed: 
https://avro.apache.org/docs/1.11.1/specification/#arrays
I added this to lang\csharp\src\apache\main\Schema\ArraySchema.cs
But since I don't have write access to the repository, I cannot create a pull 
request.

Add to ArraySchema class:
        public JToken DefaultValue { get; set; }


Add to end of  internal static ArraySchema NewInstance(JToken jtok, PropertyMap 
props, SchemaNames names, string encspace)
            var defaultValue = jtok["default"];
            return new ArraySchema(schema, props, defaultValue);

Change constructor:
        private ArraySchema(Schema items, PropertyMap customAttributes, JToken 
defaultValue = null)
            : base(Type.Array, customAttributes)
        {
            ItemSchema = items ?? throw new 
ArgumentNullException(nameof(items));
            DefaultValue = defaultValue;
        }
Add to end of         protected internal override void 
WriteJsonFields(Newtonsoft.Json.JsonTextWriter writer, SchemaNames names, 
string encspace)
            if (null != this.DefaultValue)
            {
                writer.WritePropertyName("default");
                this.DefaultValue.WriteTo(writer, null);
            }


Regards,
Robin

----------------------------------------------------------------------
Moody's monitors email communications through its networks for regulatory 
compliance purposes and to protect its customers, employees and business and 
where allowed to do so by applicable law. The information contained in this 
e-mail message, and any attachment thereto, is confidential and may not be 
disclosed without our express permission. If you are not the intended recipient 
or an employee or agent responsible for delivering this message to the intended 
recipient, you are hereby notified that you have received this message in error 
and that any review, dissemination, distribution or copying of this message, or 
any attachment thereto, in whole or in part, is strictly prohibited. If you 
have received this message in error, please immediately notify us by telephone, 
fax or e-mail and delete the message and all of its attachments. Every effort 
is made to keep our network free from viruses. You should, however, review this 
e-mail message, as well as any attachment thereto, for viruses. We take no 
responsibility and have no liability for any computer virus which may be 
transferred via this e-mail message.

Reply via email to