Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Issue: Objects and arrays get wrong parent if they have text nodes as siblings #329

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NitinRamnani
Copy link

@NitinRamnani NitinRamnani commented Apr 18, 2023

Link to issue: #320

Fix: brothers Id was being passed to addEdgeToGraph() in traverse() which was adding incorrect edge, that is, it was adding edge from brother to the node. Fixed it by passing brother's parentId so that new edge is created between parent and node.

Input:

{
  "body": [
    {
      "text": "klsadfkjasf",
      "jo": "mo",
      "object": {
        "test": 2
      },
      "array": [
        {
          "text": "khjasd",
          "operation": "lksfj",
          "action": {
            "url": "test.com"
          }
        }
      ]
    }
  ]
}

Output before:

before

Output After:

after

@TallTed
Copy link
Contributor

TallTed commented Apr 18, 2023

@NitinRamnani — Your initial comment will be much easier to understand, if you edit it to add two lines that contains only three backticks, as below —

```

One such "code fence" goes below the line reading Input:, and the other goes above the line reading Output before:.

@AykutSarac
Copy link
Owner

We'd consider adding it to settings and not enabling by default because it serves a different mode of view. Current one is making it easier to understand, but your implementation makes it more correct.

@AykutSarac
Copy link
Owner

Taking feedbacks for which one's readability is better:

{
  "image": "golang:latest",
  "stages": [
    "test",
    "build",
    "deploy"
  ],
  "format": {
    "stage": "test",
    "script": [
      "go fmt $(go list ./... | grep -v /vendor/)",
      "go vet $(go list ./... | grep -v /vendor/)",
      "go test -race $(go list ./... | grep -v /vendor/)"
    ]
  },
  "compile": {
    "stage": "build",
    "script": [
      "mkdir -p mybinaries",
      "go build -o mybinaries ./..."
    ],
    "artifacts": {
      "paths": [
        "mybinaries"
      ]
    }
  },
  "deploy": {
    "stage": "deploy",
    "script": "echo \"Define your deployment script!\"",
    "environment": "production"
  }
}

image

image

@mahtikebab
Copy link

Thanks for fixing this!

@AykutSarac Definitely the fixed version (1) is better because it's correct. I don't understand how (2) would be better because it's clearly describing a faulty relationship between the nodes compared to the JSON. If we want to have a hierarchy like the one in image 2 we need to describe it in the JSON structure also, i.e. the "image": "golang:latest" is a parent of the other nodes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants