Skip to content
This repository was archived by the owner on Jun 8, 2022. It is now read-only.
This repository was archived by the owner on Jun 8, 2022. It is now read-only.

[Feature]Support for merging multiple JSON/XML fragments to cover complex types #157

Open
@ifree613

Description

@ifree613

Is your feature request related to a problem? Please describe.

Ref to Pull requests : #134

Describe the solution you'd like

Support for merging multiple JSON/XML fragments to cover complex types

  • Sample JSON fragment 1,patch1
{
  "spec": {
    "containers": [
      {
        "env": [
          {
            "name": "DEBUG_ENABLE",
            "value": "true"
          },
          {
            "name": "ENV_FLAG",
            "value": "test"
          }
        ]
      }
    ]
  }
}
  • Sample JSON fragment 1,patch2
{
  "spec": {
    "containers": [
      {
        "env": [
          {
            "name": "OPEN_TRACING",
            "value": "true"
          },
          {
            "name": "ENV_FLAG",
            "value": "dev"
          }
        ]
      }
    ]
  }
}
  • Call the merge API sample

data := mergeTool.merge(&patch1,patch2)

Note: By specifying the merged parameters, the first is used as the basis, and the subsequent ones override and append related parameters in turn

  • The result of the merge
{
  "spec": {
    "containers": [
      {
        "env": [
          {
            "name": "DEBUG_ENABLE",
            "value": "true"
          },
          {
            "name": "OPEN_TRACING",
            "value": "true"
          },
          {
            "name": "ENV_FLAG",
            "value": "dev"
          }
        ]
      }
    ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions