Re: [Json] RFC 4627bis vs RFC 6902 (JSON Patch)

Nico Williams <nico@cryptonector.com> Thu, 20 February 2014 17:44 UTC

Return-Path: <nico@cryptonector.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7C7961A0053 for <json@ietfa.amsl.com>; Thu, 20 Feb 2014 09:44:41 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.378
X-Spam-Level:
X-Spam-Status: No, score=-1.378 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FM_FORGED_GMAIL=0.622, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=no
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 rC9zt1FvgUcW for <json@ietfa.amsl.com>; Thu, 20 Feb 2014 09:44:40 -0800 (PST)
Received: from homiemail-a63.g.dreamhost.com (caiajhbdcbef.dreamhost.com [208.97.132.145]) by ietfa.amsl.com (Postfix) with ESMTP id 2672E1A01AF for <json@ietf.org>; Thu, 20 Feb 2014 09:44:40 -0800 (PST)
Received: from homiemail-a63.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a63.g.dreamhost.com (Postfix) with ESMTP id B19682F4075 for <json@ietf.org>; Thu, 20 Feb 2014 09:44:36 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cryptonector.com; h= mime-version:in-reply-to:references:date:message-id:subject:from :to:cc:content-type; s=cryptonector.com; bh=UysC+H3MAshMARjT5uq8 3mGeV/U=; b=MzX1LpcJRMwH8dMz2eTj+QQULAY2QQs8gpGSiktEWRsXKHOCh99e l3wA1yDVHueS1nVR4Kt+hEaAyz9G8447cqyAlDR84khz7i5hZx0G4626zUGgSPcg +ptSiDKVwGeFpRK9XWk9C2zKcb+HA9NjWNJYtJYuOZQUEH7obIIX5JM=
Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: nico@cryptonector.com) by homiemail-a63.g.dreamhost.com (Postfix) with ESMTPSA id 57B7E2F406D for <json@ietf.org>; Thu, 20 Feb 2014 09:44:36 -0800 (PST)
Received: by mail-we0-f181.google.com with SMTP id w61so1673497wes.26 for <json@ietf.org>; Thu, 20 Feb 2014 09:44:35 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=C1AGKpVjzEFodxtJHIm82OOim0HIP185IYAcucajlGY=; b=eKkBlSO/qsIeoyb7B18EgS7FbxxMkE7cquG7EZbrbcyNI2gCOrsQkbOnoi1IglMOZ8 yDKP7qVHwYiC6wdVd9j4OOHgfGkHPDTr1NRoWjGOc4E6Fv06rRuVCZdQ992pGfRcazCi VdSWhVeQrFpbTKaotzhsDYH+0xlYg3YXUJYr7nWsnCQ0r1wtRsObYgFs94YLnAMGYNaR q2WUG63ztmA7vjvE1WXk6GYta3bdcC1B0yeWs+V+lSge8rFXEoCtmMtA3/gDrdWLhoSE d7ad5tiooOrl3cQYRsGrsKFBC3bDPXvIFkBXeknw18H1Ji29Ea+gmoXXW15hzT7SpVNC BAiQ==
MIME-Version: 1.0
X-Received: by 10.180.98.35 with SMTP id ef3mr8225665wib.39.1392918274992; Thu, 20 Feb 2014 09:44:34 -0800 (PST)
Received: by 10.217.108.132 with HTTP; Thu, 20 Feb 2014 09:44:34 -0800 (PST)
In-Reply-To: <CALcybBBmkhwFWiqB+3Fz8vpLm1WZwmoXTkDi9FUhZY8Ftnj0dw@mail.gmail.com>
References: <CALcybBCTih9A6RL=r4WYrqf05rHsjgF4tEJP3cTY2FAmONRQaw@mail.gmail.com> <CAC4RtVD5J2oeTQGDNW5=M1oO4MuY_7i7z9G1Q=+icLr9su8aUQ@mail.gmail.com> <CALcybBBmkhwFWiqB+3Fz8vpLm1WZwmoXTkDi9FUhZY8Ftnj0dw@mail.gmail.com>
Date: Thu, 20 Feb 2014 11:44:34 -0600
Message-ID: <CAK3OfOheh0y_XV0FBwgN6Wv2Lt+gM-pXN4gGO48Q_eX5QtUmvw@mail.gmail.com>
From: Nico Williams <nico@cryptonector.com>
To: Francis Galiegue <fgaliegue@gmail.com>
Content-Type: text/plain; charset="UTF-8"
Archived-At: http://mailarchive.ietf.org/arch/msg/json/ZImRIp5k-4K3WqJ0V-fgJUeJ9hE
Cc: Barry Leiba <barryleiba@computer.org>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] RFC 4627bis vs RFC 6902 (JSON Patch)
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.15
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: <http://www.ietf.org/mail-archive/web/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: Thu, 20 Feb 2014 17:44:41 -0000

On Thu, Feb 20, 2014 at 11:35 AM, Francis Galiegue <fgaliegue@gmail.com> wrote:
> On Thu, Feb 20, 2014 at 6:31 PM, Barry Leiba <barryleiba@computer.org> wrote:
>>> The latter makes sense on the _producer_ of a patch operation;
>>> however, on the parser side, should a parser receive a "malformed"
>>> (f.e duplicated "op") operation, it seems to me that RFC 6902 expects
>>> the parser to raise an error -- which RFC 4627bis does not mandate.
>>
>> What do you see as a conflict?
>>
>> The JSON spec gives general parameters for JSON, and allows duplicates.
>>
>> The JSON Patch spec gives specific parameters for a specific use of
>> JSON.  For that use, duplicates are not allowed.
>>
>> That all looks just fine to me, and absolutely consistent.
>>
>
> Not to me. As I see it, 75+% of JSON parsers on the "market" just
> cannot parse JSON Patch correctly because of the restrictions imposed
> by RFC 6902. Note: parse, not emit (or "consume, not produce" -- or
> whatever metaphor suits you).

JSON Patch predates the discussions as to RFC4627bis, so a bit of
mismatch is to be expected.  JSON Patch says "objects MUST have
exactly one ..." but parser behavior is not specified, so it's unclear
if that's a requirement for encoders or parsers.  Even if you
interpret that as a requirement for parsers, the requirement may be
met by the application rather than the parser (e.g., when the
application uses an online JSON parser).

We had very many very lengthy threads on subjects like this in the
JSON WG, and I'm pretty sure that we discussed JSON Patch in
particular as well.  You might want to look at the archives.

> IOW: I don't see "MUST have a unique member named 'foo'" and
> "behaviour is unpredictable" as being consistent with one another.

The former is insufficiently prescriptive, therefore ill-defined,
therefore consistent with the latter.

FWIW, the JSON WG had proposals to improve this and other aspects of
JSON, but it was heavily constrained by _actual_ practice in the wild.

Nico
--