Open APIs

Expand all | Collapse all

TMF 632 Patch with JSON Merge Patch

  • 1.  TMF 632 Patch with JSON Merge Patch

    TM Forum Member
    Posted May 07, 2021 10:04
    Hi,

    How is the implementation for HTTP PATCH via JSON merge patch to be carried for TMF 632,  for arrays, say party characteristic?

    According to RFC 7386 - JSON Merge Patch, JSON merge patch cannot be used to make changes to an element within array, rather the complete array needs to passed on.

    ------------------------------
    Ramkumar M G

    ------------------------------


  • 2.  RE: TMF 632 Patch with JSON Merge Patch

    TM Forum Member
    Posted May 09, 2021 01:39
    Hi Ramkumar
    It is for this reason that there are multiple PATCH semantics. Merge is probably the easiest, but as you note correctly it doesn't do arrays well. For arrays best to use JSON PATCH, as in http://tools.ietf.org/html/rfc6902
    This is covered in the design guidelines for Open APIs, TMF630.
    Hope it helps

    ------------------------------
    Jonathan Goldberg
    Amdocs Management Limited
    Any opinions and statements made by me on this forum are purely personal, and do not necessarily reflect the position of the TM Forum or my employer.
    ------------------------------



  • 3.  RE: TMF 632 Patch with JSON Merge Patch

    TM Forum Member
    Posted May 12, 2021 02:11
    Hi Jonathan,

    Thanks. However, as per the tmf document for tmf 632, JSON Merge Patch is mentioned as a mandatory implementation for HTTP Patch, so was curious on how to handle patching of arrays.

    Thanks

    ------------------------------
    Ramkumar M G
    Torry Harris Integration Solutions
    ------------------------------



  • 4.  RE: TMF 632 Patch with JSON Merge Patch

    TM Forum Member
    Posted May 12, 2021 02:55
    I refer you to the design guidelines TMF630 part 5 for handling array updates. Basically merge won't do it, you have to do JSON Patch, with operators working on the relevant array or element within the array. They show examples there.
    Hope it helps

    ------------------------------
    Jonathan Goldberg
    Amdocs Management Limited
    Any opinions and statements made by me on this forum are purely personal, and do not necessarily reflect the position of the TM Forum or my employer.
    ------------------------------



  • 5.  RE: TMF 632 Patch with JSON Merge Patch

    TM Forum Member
    Posted May 17, 2021 08:54
    Hi Jonathan,

    Thanks.

    My other query is though the tmf spec mentions supported Content-Type as application/json, but can this be extended to support application/merge-patch+json?

    ------------------------------
    Ramkumar M G
    Torry Harris Integration Solutions
    ------------------------------



  • 6.  RE: TMF 632 Patch with JSON Merge Patch

    TM Forum Member
    Posted May 18, 2021 01:42
    Hi
    I quote from the design guidelines Part One (TMF630):
    • In case of PATCH if application/json is provided then the default rule will be to apply the same rules as for JSON merge.
    • In case of JSON Patch [RFC6902] for partial updates "application/json-patch+json" media type MUST be used.
    • In case of JSON PATCH Query, "application/json-patch-query+json" media type MUST be used.
    • In case of PATCH as per https://tools.ietf.org/html/rfc7386 "application/merge-patch+json" MUST be used
    Is it clear now?

    ------------------------------
    Jonathan Goldberg
    Amdocs Management Limited
    Any opinions and statements made by me on this forum are purely personal, and do not necessarily reflect the position of the TM Forum or my employer.
    ------------------------------



  • 7.  RE: TMF 632 Patch with JSON Merge Patch

    TM Forum Member
    Posted May 18, 2021 01:46
    Hi Jonathan,

    Thanks, clear now

    ------------------------------
    Ramkumar M G
    Torry Harris Integration Solutions
    ------------------------------