RFC Errata


Errata Search

 
Source of RFC  
Summary Table Full Records

Found 1 record.

Status: Verified (1)

RFC 7386, "JSON Merge Patch", October 2014

Note: This RFC has been obsoleted by RFC 7396

Source of RFC: appsawg (app)

Errata ID: 4132

Status: Verified
Type: Technical

Reported By: Stéphane Bortzmeyer
Date Reported: 2014-10-15
Verifier Name: Barry Leiba
Date Verified: 2014-10-16

Section 2 says:

define MergePatch(Target, Patch):
       if Patch is an Object:
         if Target is not an Object:
       Target = {} # Ignore the contents and set it to an empty Object
         for each Name/Value pair in Patch:
       if Value is null:
         if Name exists in Target:
           remove the Name/Value pair from Target
       else:
         Target[Name] = MergePatch(Target[Name], Value)
         return Target
       else:
         return Patch

It should say:

   define MergePatch(Target, Patch):
     if Patch is an Object:
       if Target is not an Object:
         Target = {} # Ignore the contents and set it to an empty Object
       for each Name/Value pair in Patch:
         if Value is null:
           if Name exists in Target:
             remove the Name/Value pair from Target
         else:
           Target[Name] = MergePatch(Target[Name], Value)
       return Target
     else:
       return Patch

Notes:

Indentation of the pseudo-code example was correct in the Internet-Drafts but was messed up in the final version. For instance, "Target = {}" should be under the two ifs. (Reported by James H. Manger on the appsawg mailing list.)

This is a technical erratum, rather than editorial, because the correct indentation is essential to understanding the pseudocode.

Report New Errata