Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
haskell-gargantext
Commits
6bc41d73
Verified
Commit
6bc41d73
authored
Jun 20, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[node] fix pubmed JSON serialization
parent
79d0ea23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
Types.hs
src/Gargantext/API/Node/Corpus/Types.hs
+9
-13
No files found.
src/Gargantext/API/Node/Corpus/Types.hs
View file @
6bc41d73
...
...
@@ -49,21 +49,17 @@ data Datafield = Gargantext
deriving
(
Eq
,
Show
,
Generic
)
instance
FromJSON
Datafield
where
parseJSON
=
withText
"Datafield"
$
\
text
->
case
text
of
"Gargantext"
->
pure
Gargantext
"Web"
->
pure
Web
"Files"
->
pure
Files
v
->
case
T
.
breakOnEnd
" "
v
of
(
"External "
,
dbName
)
->
External
<$>
parseJSON
(
String
dbName
)
_
->
fail
$
"Cannot match patterh 'External <db>' for string "
<>
T
.
unpack
v
parseJSON
(
String
"Gargantext"
)
=
pure
Gargantext
parseJSON
(
String
"Web"
)
=
pure
Web
parseJSON
(
String
"Files"
)
=
pure
Files
parseJSON
(
Object
o
)
=
do
db
<-
o
.:
"External"
pure
$
External
db
parseJSON
x
=
withText
"Datafield"
(
\
text
->
fail
$
"Cannot match pattern '<db>' for string "
<>
T
.
unpack
text
)
x
instance
ToJSON
Datafield
where
toJSON
(
External
db
)
=
toJSON
$
"External "
<>
show
db
toJSON
(
External
db
)
=
toJSON
$
object
[
(
"External"
,
toJSON
db
)
]
toJSON
s
=
toJSON
$
show
s
instance
Arbitrary
Datafield
where
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment