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

fix empty nodes #242

Closed
wants to merge 0 commits into from
Closed

Conversation

victorbrambati
Copy link
Contributor

I changed the parsing algorithm to be more malleable. It's more easy to fix any problem.
In terms of performance it's a little faster.

Problems solved:
This problem is from [Bug] Nested objects causing empty nodes #27
1

{
  "properties": {
    "definitions": {
      "type": "object",
      "additionalProperties": {
        "$dynamicRef": "#meta"
      },
      "deprecated": true
    }
  }
}

And Nesting issue dictionary with an Int and other dictionaries #51
2

 "limit": {
      "maximum": {
        "errorMessage": "Enter an amount within your %@ credit limit",
        "value": 2000
      },
      "minimum": {
        "errorMessage": "Enter an amount of %@ or higher",
        "value": 200
      },
      "value": 1000
    }

This parsing algorithm solve these both problems at once.

@AykutSarac
Copy link
Owner

That's awesome work Victor! I'm currently testing your PR. I'll share the bugs & improvements could be made here.

Currently I found these:

  • Backslash creating new lines
  • Node width not working correctly
  • Children count not working

You can work with this JSON to see bugs, looks like it doesn't work

{
  "status": "OPEN",
  "body": "{\"document\":[{\"e\":\"par\",\"c\":[{\"e\":\"text\",\"t\":\"Hello \"},{\"e\":\"link\",\"t\":\"r/formula1\",\"u\":\"https://new.reddit.com/r/formula1/\",\"f\":[[0,0,10]]}]},{\"e\":\"par\",\"c\":[{\"e\":\"text\",\"t\":\"What week is it? It's RAWE CEEK!\"}]},{\"e\":\"par\",\"c\":[{\"e\":\"text\",\"t\":\"And that means it's also time for another round of the 2022 Predictions Tournament.\"}]},{\"e\":\"par\",\"c\":[{\"e\":\"text\",\"t\":\"The deadline for this prediction is at the start of the race!\",\"f\":[[1,0,61]]}]}]}",
  "is_rtjson": true,
  "is_nsfw": false,
  "title": "Will Haas score points in their home race at the United States GP?",
  "created_at": 1666180326000,
  "voting_end_timestamp": 1666551600000,
  "id": "t3_y80npi",
  "vote_updates_remained": null,
  "resolved_option_id": null,
  "user_won_amount": null,
  "is_spoiler": false,
  "user_selection": null,
  "options": [
    {
      "total_amount": 514490,
      "text": "Yes",
      "vote_count": 9053,
      "user_amount": null,
      "image_url": null,
      "id": "19244636"
    },
    {
      "total_amount": 676310,
      "text": "No",
      "vote_count": 11292,
      "user_amount": null,
      "image_url": null,
      "id": "19244637"
    }
  ],
  "total_stake_amount": 1190800,
  "total_vote_count": 20345
}

@victorbrambati
Copy link
Contributor Author

@AykutSarac Thank you for feedback, I noticed that is impossible with regex create a solution for this JSON that you mentioned. But I found other tool instead of regex and will work without bugs. I will work in it.

@AykutSarac
Copy link
Owner

@AykutSarac Thank you for feedback, I noticed that is impossible with regex create a solution for this JSON that you mentioned. But I found other tool instead of regex and will work without bugs. I will work in it.

Thank you for working on this, it's indeed a very core problem. I'm looking forward to see your solution, converting this PR to draft for now.

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.

2 participants