Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E52DC200ACA for ; Fri, 20 May 2016 00:50:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E3838160A0D; Thu, 19 May 2016 22:50:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3955A160A1D for ; Fri, 20 May 2016 00:50:14 +0200 (CEST) Received: (qmail 54513 invoked by uid 500); 19 May 2016 22:50:13 -0000 Mailing-List: contact dev-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@avro.apache.org Delivered-To: mailing list dev@avro.apache.org Received: (qmail 54358 invoked by uid 99); 19 May 2016 22:50:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2016 22:50:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 0D41D2C1F62 for ; Thu, 19 May 2016 22:50:13 +0000 (UTC) Date: Thu, 19 May 2016 22:50:13 +0000 (UTC) From: "Brian McKelvey (JIRA)" To: dev@avro.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (AVRO-1848) Can't use null or false defaults in Ruby MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 19 May 2016 22:50:15 -0000 [ https://issues.apache.org/jira/browse/AVRO-1848?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Brian McKelvey updated AVRO-1848: --------------------------------- Status: Patch Available (was: Open) https://github.com/apache/avro/pull/96 > Can't use null or false defaults in Ruby > ---------------------------------------- > > Key: AVRO-1848 > URL: https://issues.apache.org/jira/browse/AVRO-1848 > Project: Avro > Issue Type: Bug > Components: ruby > Affects Versions: 1.8.0 > Environment: Any > Reporter: Brian McKelvey > Priority: Critical > Labels: easyfix > Original Estimate: 2h > Remaining Estimate: 2h > > When calling {{to_avro}} on an {{Avro::Field}} instance (part of calling {{to_avro}} on an instance of {{Avro::Schema}}), it will not include the default value definition if the default value is falsey. > The offending code is: > {code:ruby} > def to_avro(names=Set.new) > {'name' => name, 'type' => type.to_avro(names)}.tap do |avro| > avro['default'] = default if default > avro['order'] = order if order > end > end > {code} > Using the {{if default}} conditional predicate here is inappropriate, as is relying on `nil` values to represent no default, as `null` in JSON maps to `nil` in Ruby. > This is a critical show-stopper to using AvroTurf with the Confluent Schema Registry because it is quietly uploading incorrect schemas, causing downstream readers to behave incorrectly and also causing the schema registry to reject new schema versions as incompatible when they are actually just fine if the falsey default values are included when submitting the schema to the registry. -- This message was sent by Atlassian JIRA (v6.3.4#6332)