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
160
Issues
160
List
Board
Labels
Milestones
Merge Requests
14
Merge Requests
14
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
gargantext
haskell-gargantext
Commits
6bc41d73
Verified
Commit
6bc41d73
authored
Jun 20, 2023
by
Przemyslaw Kaminski
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[node] fix pubmed JSON serialization
parent
79d0ea23
Pipeline
#4251
failed with stages
in 42 minutes and 59 seconds
Changes
1
Pipelines
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
...
...
Alfredo Di Napoli
@AlfredoDiNapoli
mentioned in commit
a1f1f091
·
Jul 10, 2023
mentioned in commit
a1f1f091
mentioned in commit a1f1f0913e66eed25d0eb47ec055d1f19980a2ee
Toggle commit list
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