Re: [Json] Another problematic JSON Schema use-case

"Joe Hildebrand (jhildebr)" <jhildebr@cisco.com> Mon, 23 May 2016 15:41 UTC

Return-Path: <jhildebr@cisco.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D636A12D99C for <json@ietfa.amsl.com>; Mon, 23 May 2016 08:41:30 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -15.947
X-Spam-Level:
X-Spam-Status: No, score=-15.947 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Zgj5PC6hKy5w for <json@ietfa.amsl.com>; Mon, 23 May 2016 08:41:29 -0700 (PDT)
Received: from alln-iport-7.cisco.com (alln-iport-7.cisco.com [173.37.142.94]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 0C9DE12D993 for <json@ietf.org>; Mon, 23 May 2016 08:41:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1380; q=dns/txt; s=iport; t=1464018089; x=1465227689; h=from:to:subject:date:message-id:references:in-reply-to: content-id:content-transfer-encoding:mime-version; bh=64Tjk9eUQiYYYaeFxdXk1b+2QbEbwu10tVEbPBM65/c=; b=RZnc6qsLuWp4UNyd5mZnL3PRhDMKBOBoajn6SkxW0/DXYlY7JWSyka40 ZbR7f9kMaZ0l4YmScBU7apjePpPhE+VyrpHs+5y5SBgsXAfUWwY3weKKJ Cllvjtj/V+dH2ohOfYiIAJcmQRCLylhIpiicJouOKjQ31mKMwJigZqYag o=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0BcBQBoI0NX/4QNJK1bgzdWfQa3bIQUIoVvAhyBEzsRAQEBAQEBAWUnhEMBAQQjEVUCAQgODAImAgICMBUQAgQBEogvDrM9kT8BAQEBAQEBAQEBAQEBAQEBAQEBAQEXBYEBhSaBdgiCT4Q/gwErgi4FmDcBjh+BaY0zhjOJGAE2LIIGBBiBS26IFSUYfwEBAQ
X-IronPort-AV: E=Sophos;i="5.26,356,1459814400"; d="scan'208";a="276804439"
Received: from alln-core-10.cisco.com ([173.36.13.132]) by alln-iport-7.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 May 2016 15:41:28 +0000
Received: from XCH-RTP-001.cisco.com (xch-rtp-001.cisco.com [64.101.220.141]) by alln-core-10.cisco.com (8.14.5/8.14.5) with ESMTP id u4NFfRVi023628 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 23 May 2016 15:41:28 GMT
Received: from xch-rtp-001.cisco.com (64.101.220.141) by XCH-RTP-001.cisco.com (64.101.220.141) with Microsoft SMTP Server (TLS) id 15.0.1104.5; Mon, 23 May 2016 11:41:27 -0400
Received: from xch-rtp-001.cisco.com ([64.101.220.141]) by XCH-RTP-001.cisco.com ([64.101.220.141]) with mapi id 15.00.1104.009; Mon, 23 May 2016 11:41:27 -0400
From: "Joe Hildebrand (jhildebr)" <jhildebr@cisco.com>
To: Tim Bray <tbray@textuality.com>, "json@ietf.org" <json@ietf.org>
Thread-Topic: [Json] Another problematic JSON Schema use-case
Thread-Index: AQHRtFXy/R2imDBXvkmlE5Z/zz9P2p/GeCsA
Date: Mon, 23 May 2016 15:41:26 +0000
Message-ID: <812B862C-4D8F-4173-9BDC-479A1A31C72A@cisco.com>
References: <CAHBU6ivd5JJ7Hx_JtNPSnW40jXzEF1Yr7=rwuZzGnFrRoMphbg@mail.gmail.com>
In-Reply-To: <CAHBU6ivd5JJ7Hx_JtNPSnW40jXzEF1Yr7=rwuZzGnFrRoMphbg@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
user-agent: Microsoft-MacOutlook/f.16.0.160506
x-ms-exchange-messagesentrepresentingtype: 1
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [10.24.64.11]
Content-Type: text/plain; charset="utf-8"
Content-ID: <C75C0BF3527FAC4D9E27ABAB2EBBCBD9@emea.cisco.com>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/K9Ne_QBfinYDKYuu7MOVmPfJoTs>
Subject: Re: [Json] Another problematic JSON Schema use-case
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 23 May 2016 15:41:31 -0000

On 5/22/16, 12:15 PM, "json on behalf of Tim Bray" <json-bounces@ietf.org on behalf of tbray@textuality.com> wrote:

>See https://www.tbray.org/ongoing/When/201x/2016/05/22/Json-Schema-Gripe


The CDDL I’m currently using for one part of draft-hildebrand-deth is:

```
update = A_update / AAAA_update / ...

A_update = {
  rtype: "A",
  v4address: tstr,
  common
}

AAAA_update = {
  rtype: "AAAA",
  v6address: tstr,
  common
}

common = (
  ? ttl: uint,
  ? comment: tstr,
  ? uid: tstr
)

```

The discriminant is the “rtype” field, and then each rtype has a set of common optional fields, and a set of required rtype-specific fields.

When you pass in this JSON: `{"rtype": "AAAA"}`

The CDDL tooling gives this error:

```
CDDL validation failure (nil for {"rtype"=>"AAAA"}):
["AAAA", [:prim, 3], nil]
```

Which is a little esoteric, granted, but when deciphered says that the “AAAA” key is required, but wasn’t there.

-- 
Joe Hildebrand