Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
haskell-gargantext
haskell-gargantext
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 166
    • Issues 166
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 11
    • Merge Requests 11
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • gargantext
  • haskell-gargantexthaskell-gargantext
  • Merge Requests
  • !167

Merged
Opened Jun 20, 2023 by Alfredo Di Napoli@AlfredoDiNapoli
  • Report abuse
Report abuse

Add proper JSON schema for Phylo graph data

Hopefully helps with #206 (closed).

@anoe I have now manually added a "schema" for the JSON by manually writing all the required instances, and wrote quite a bit of tests, including two golden tests. The second test, the one called testOpenSciencePhylo is the most important one, because it tries to decode the JSON emitted by gargantext which currently cannot be decoded by the purescript frontend.

Initially, when writing this test, I've got a failure, because the nodes field couldn't be found, and to mitigate that I have made the JSON parser a bit more lenient: whenever we encounter a Layer node which has no nodes field, we default to the empty list. @qlobbe I'm not really an expert on the phylo JSON format, but do you think this is a bug or we can genuinely emit an object from our Phylo code that has no nodes?

Either way, I can speculate (mind, is a wild guess!) now why I think the Purescript frontend was failing: the PS frontend was trying to parse a RawObject by trying to parse each and every object type (one between Layer, PeriodToNode etc). Conceivably Layer was the first one tried, but the parsing failed because nodes wasn't there. Therefore, the next available parser was attempted, i.e. the one for PeriodToNode, but the input JSON didn't have the bId field, and therefore the PS frontend failed with that message.

Long story short, I would expect that after we merge this patch, something should change; either we would get parsing errors when producing the GraphData from the backend, or we should see a slightly different error in the frontend.

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b adinapoli/fix-phylo-types origin/adinapoli/fix-phylo-types

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout origin/dev
git merge --no-ff adinapoli/fix-phylo-types

Step 4. Push the result of the merge to GitLab

git push origin dev

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

  • Discussion 1
  • Commits 2
  • Pipelines 2
  • Changes 6
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
0
Labels
None
Assign labels
  • View project labels
Reference: gargantext/haskell-gargantext!167

Revert this merge request

This will create a new commit in order to revert the existing changes.

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.