Return-Path: X-Original-To: apmail-avro-user-archive@www.apache.org Delivered-To: apmail-avro-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 77C5817619 for ; Tue, 31 Mar 2015 07:16:45 +0000 (UTC) Received: (qmail 1175 invoked by uid 500); 31 Mar 2015 07:16:44 -0000 Delivered-To: apmail-avro-user-archive@avro.apache.org Received: (qmail 1101 invoked by uid 500); 31 Mar 2015 07:16:44 -0000 Mailing-List: contact user-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@avro.apache.org Delivered-To: mailing list user@avro.apache.org Received: (qmail 1091 invoked by uid 99); 31 Mar 2015 07:16:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Mar 2015 07:16:44 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of harsh@cloudera.com designates 209.85.223.176 as permitted sender) Received: from [209.85.223.176] (HELO mail-ie0-f176.google.com) (209.85.223.176) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Mar 2015 07:16:20 +0000 Received: by iedm5 with SMTP id m5so8780597ied.3 for ; Tue, 31 Mar 2015 00:14:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=ErO13JwCUhv57TIiEYfIeHyJqSZNC/4Fxqx1V4HgDSc=; b=RzjZxz6gG1rqnJiZR5SuDSTA7YLEUGHnSIiy9FMDx+m0ufUyovYcCmJ4+jWFXNtx0J LIgbmsGdLmQAnf+56PPKDHHc5Y+PFqiJ9Ci5cGKLkT2vurwYOFWjKd8S4e2inoA/PxyP qHiB5mCPnG0d5CamWhsMAJstzVgMlxe/R2ejVtSVebV4kF7TSkeK87m1gUgdWm44Stio DzPi0MwmKCDq4MryvdiSTngBlvG0dCPtc6WRRekJwFceSV1+PZsTKtbUi2fXKO59D2sz iCjT/DuKSYqlrTl0ii5hEUgjm/CT+SCcXz6kdo45sKIjak+TLhe0usPVxCXCGEp1nf32 v0Aw== X-Gm-Message-State: ALoCoQnUkYw2ujJo/KkLznQS7fVBecY5MOhpjbkWNRX8aGwbAzd7MKf8fuVeK0mEbq/z6HDDHViU X-Received: by 10.107.137.218 with SMTP id t87mr1206688ioi.3.1427786041977; Tue, 31 Mar 2015 00:14:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.9.144 with HTTP; Tue, 31 Mar 2015 00:13:41 -0700 (PDT) In-Reply-To: References: From: Harsh J Date: Tue, 31 Mar 2015 12:43:41 +0530 Message-ID: Subject: Re: Value constraints in schemas? To: "user@avro apache. org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org No, arbitrary value constraints (aside of "null" checks) cannot be expressed in the schema currently: http://avro.apache.org/docs/current/spec.html#schema_primitive. All values for a given primitive type are taken as a valid one. On Mon, Mar 30, 2015 at 9:00 PM, Avi Flax wrote: > Hi all, I=E2=80=99m new to Avro so I apologize if this is a FAQ =E2=80=94= I did try to > search the list archives, Google, the spec, etc=E2=80=A6 > > I just wrote a module that serializes and deserializes a certain data > structure to/from Avro and my module also has a validate method for > validating value constraints that so far I have yet to see how to > express in my Avro schema. For example that certain int fields may not > be 0, or that certain string fields may not be empty. > > Is it possible to express such constraints in an Avro schema? > > Thanks! > Avi --=20 Harsh J