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

Tim Bray <tbray@textuality.com> Tue, 24 May 2016 03:54 UTC

Return-Path: <tbray@textuality.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 27E8312D0A0 for <json@ietfa.amsl.com>; Mon, 23 May 2016 20:54:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=textuality-com.20150623.gappssmtp.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 mkPwwkqRqzIN for <json@ietfa.amsl.com>; Mon, 23 May 2016 20:54:53 -0700 (PDT)
Received: from mail-qk0-x231.google.com (mail-qk0-x231.google.com [IPv6:2607:f8b0:400d:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 9E5E112D5DA for <json@ietf.org>; Mon, 23 May 2016 20:54:53 -0700 (PDT)
Received: by mail-qk0-x231.google.com with SMTP id y126so3302881qke.1 for <json@ietf.org>; Mon, 23 May 2016 20:54:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=textuality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=u+6OdpaC2nlxl2BE8Mq7OepOqGxuz5e+4YOZwNFtx9s=; b=k/9J+Yk2m8LnvOtCJ+GyDba3r27Eit2HGozNsTujShqzk9sEQgniLVVXh4BhuVcJbo eoYK5HC2kWe5+V10h9EpO42fTSyDTXU/yuHy5iBaJB77cdkpyu/3/ofYQRi+lc4fEzcX 4JUpgRZ7srrEEcA1s/mwKBthUN0F2WkzewulLCBNxGDF3M/6pHbLHIqceOQeaag6MoAX xuaLw+Dv1vpU6ftP8A9OZj3J6EoCCxiN7kZnqo/thXINRXB7tHksMcV4qGZU1m6D2UPW +vEBDmafOVcLwdhsfr/l1pWroBkn3cpkpS14p3V3JKqqIqh0EGprnA8vDoHZ92gz6ROW KCYg==
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:cc; bh=u+6OdpaC2nlxl2BE8Mq7OepOqGxuz5e+4YOZwNFtx9s=; b=HWjWDxhywtaTp1cl9hofckTiUedstywF0wp4CnBnTyhxeYV8rREcIvxDFWOt1sLzxG 5LjsbovhNXEXU24OYeSJ5cAZu+zBhgaOu3AGAv/15VlRm3awf4Tht32TiKO2csZl4sK/ tQK+M4IAmkHAUESfhCF6dToy0YLG49+s3AyHBldUvJ4wj4CgvWzACKJyabooPLxR4JGE vggQ5pVVEpqVDdg+Rnx1+nNCWRnLzby52fonvDar73dCkRBzcbwxSIS8A3WU3736iG0l mFzbu581y6c+VQ8zbygm5nzw+LFpezbTYPvm796Ug3tDRARoYHA7188lyNnYbxk2Brab FeIA==
X-Gm-Message-State: ALyK8tJongxBeZr+lWLVDFTLIRBZ55quNKoGfaEErWrcCqp8JEDrnL8/yoqJPM9W/RZYEU7pAuNDK1Cf1qPIog==
X-Received: by 10.55.215.132 with SMTP id t4mr1418680qkt.66.1464062092628; Mon, 23 May 2016 20:54:52 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.140.100.215 with HTTP; Mon, 23 May 2016 20:54:33 -0700 (PDT)
X-Originating-IP: [24.84.248.61]
In-Reply-To: <CANkuk-WppF4WgeZc5OX2-tozmCd+eYtPwFgmDtoiJHxwdSjDzw@mail.gmail.com>
References: <CAHBU6ivd5JJ7Hx_JtNPSnW40jXzEF1Yr7=rwuZzGnFrRoMphbg@mail.gmail.com> <CANkuk-WppF4WgeZc5OX2-tozmCd+eYtPwFgmDtoiJHxwdSjDzw@mail.gmail.com>
From: Tim Bray <tbray@textuality.com>
Date: Mon, 23 May 2016 20:54:33 -0700
Message-ID: <CAHBU6iu_nYyUBS-8PAJ3zER=RNKfiV532vEOeOnfr5eXbPv8Tw@mail.gmail.com>
To: Austin William Wright <aaa@bzfx.net>
Content-Type: multipart/alternative; boundary="001a1149dd5ef5f1d205338e8439"
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/yohdkToQvJ7BQP-LSaAdSMf1dFc>
Cc: "json@ietf.org" <json@ietf.org>
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: Tue, 24 May 2016 03:54:55 -0000

Hmm, I have to excerpt one line here:

On Mon, May 23, 2016 at 6:30 PM, Austin William Wright <aaa@bzfx.net> wrote:

>
> In general, JSON Schema and many other schemas are designed to ensure
> things are valid. They're not well engineered to help people fix things
> when they're invalid.
>

​I find this troubling.  I expect modern compilers to give me highly
actionable errors, with line numbers. Is the nature of JSON DSL’s and
programming languages so deeply different that this is not a reasonable
thing to ask a schema processor to do?

If so, then what are schemas for?  I’ve seen them as having two uses:

1. Specification aids
2. Debugging aids

For #1, I see schemas as a poor second-best to clear human-readable
description.
For #2, Schemas are appealingly declarative and presumably much more
compact than the equivalent declarative code.  But if they can’t tell me
what the problem is, why bother?  And furthermore, I’ve never thought
validators could rely on schemas alone, because schemas can’t check
semantic constraints (“is that a valid part number?”)