Subject: Re: [apps-discuss] JSON-Patch: testing objects [#11]

From: Mark Nottingham <[email-masked]>
Date: Wed, 5 Sep 2012 16:46:43 +1000

I've just incorporated these; see:
  http://trac.tools.ietf.org/wg/appsawg/trac/changeset/107

Thanks,

On 15/08/2012, at 4:28 AM, Paul C. Bryan <[email-masked]> wrote:

> On Sat, 2012-08-11 at 17:21 -0500, Mark Nottingham wrote:
>> I've checked in some text that tries to address #11, and ended clarifying other parts about how "test" works.
>> 
>> Proposed text:
>> 
>> ---8<---
>> 4.6.  test
>> 
>>    The "test" operation tests that a value at the specified location in
>>    the target document is equal to a specified value.  The operation
>>    object contains a "value" member that specifies the value to test
>>    for.
>> 
>>    Here, "equal" means that the target and specified values are compared
>>    using the following rules:
>> 
> 
> Possibly point-out that both values must have the same type in order to evaluate to equal? In other words, 0 the number and "0" the string are not equal.
> 
>>    o  strings: are considered equal if, after unescaping any sequence(s)
>>       in either string starting with a reverse solidus, they contain the
>>       same number of Unicode characters and their code points are
>>       position-wise equal.
>> 
> 
> s/either/both/. Logically makes sense.
> 
>>    o  numbers: are considered equal if they subtracting one from the
>>       other results in 0.
>> 
> 
> s/they //. Logically, makes sense.
> 
>>    o  arrays: are considered equal if they contain the same number of
>>       values, and each value can be considered equal to the value at the
>>       corresponding position in the other array.
>> 
>>    o  objects: are considered equal if they contain the same number of
>>       members, and each member can be considered equal to a member in
>>       the other object.  Note that ordering of the serialisation of
>>       object members is not significant.
>> 
> 
> I would point out that member equality means that the key == key (string) and value == value (both values must be of same type and evaluate equally per this section).
> 
>> 
>>    o  literals (false, true and null): are considered equal if they are
>>       the same.
>> 
>>    Note that this is a logical comparison; e.g., whitespace between the
>>    member values of an array is not significant.
>> --->8---
>> 
>> This is obviously going to need some examples (particularly around comparing numbers and strings, I think), but I wanted to make sure people were OK with this direction first.
>> 
>> In particular, does escaping strings before comparison make sense? And, is the technique for comparing numbers adequate?
>> 
>> Regards,
>> 
>> 
>> --
>> Mark Nottingham
>> 
>> http://www.mnot.net/
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> apps-discuss mailing list
>> 
>> [email-masked]
>> https://www.ietf.org/mailman/listinfo/apps-discuss
> 
> _______________________________________________
> apps-discuss mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/apps-discuss

--
Mark Nottingham   http://www.mnot.net/