This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-21
Channels
- # announcements (10)
- # aws (10)
- # babashka (23)
- # beginners (111)
- # biff (8)
- # calva (25)
- # clj-kondo (9)
- # cljsrn (4)
- # clojure (72)
- # clojure-belgium (6)
- # clojure-europe (50)
- # clojure-germany (2)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-uk (1)
- # datahike (3)
- # emacs (10)
- # graalvm (19)
- # graphql (3)
- # juxt (7)
- # kaocha (9)
- # malli (23)
- # nbb (20)
- # pathom (17)
- # pedestal (6)
- # polylith (11)
- # portal (8)
- # remote-jobs (3)
- # shadow-cljs (18)
- # sql (3)
- # tools-deps (20)
Hello, I'm trying to consume a graphql endpoint but I'm a bi lost when it come to writing to eql for it. Here's the request I'm trying to replicate:
{
"operationName":"SearchQuery",
"variables":{
"input":{
"q":"*Eucalyptus*",
"rows":50,
"fq":[
],
"page":1,
"facetLimit":20,
"facetField":[
"taxonomic_status",
"occurrence_status",
"establishment_means",
"degree_of_establishment",
"taxon_rank",
"family"
]
}
},
"query":"query SearchQuery($input: SearchInput!) {
search(input: $input) {
docs {
id
taxonRank
acceptedNameUsage
acceptedNameUsageId
acceptedNameUsageAuthorship
preferredVernacularName
scientificName
scientificNameAuthorship
family
taxonomicStatus
nameAccordingTo
__typename
}
meta {
params {
q
fq
fl
rows
__typename
}
pagination {
lastPage
total
currentPage
__typename
}
__typename
}
facetFields {
fieldName
fieldLabel
facets {
value
count
fq
__typename
}
__typename
}
__typename
}
}"
}
That's the eql I'm trying to send so far... I just don't understand how to pass the "nested" params to the query.
[{(:herb.Query/search {:herb.SearchParameters/q "*Euca*"})
[{:herb.SearchResult/docs [:herb.SearchResultDocument/id]}]}]
The public endpoint is ""
something like this:
[{`(~'SearchQuery {:q "*Eucalyptus*"
:facetField ["taxonomic_status"]})
[{:docs [:id :taxonRank :__typename]}
{:meta [{:params [:q]}
{:pagination [:lastPage]}
:__typename]}
{:facetFields [:fieldName
{:facets [:value]}
:__typename]}
:__typename]}]
Thanks mate, I got it working, thanks to pathom viz autocomplete and lots of try and error...
[{(:herb.Query/search {:input {:q "*Eucalyptus*"
:facetField ["taxonomic_status"]}})
[{:herb.SearchResult/docs [:herb.SearchResultDocument/id]}]}]
yes you can, but its important to understand what wildcard means. in Pathom, the wildcard means "expose all the data that was gathered for this entity during processing", and not "get me everything possible"
this means that if you have something that depends on a graphql thing, and add the wildcard, you will see that data there, but Pathom will not ask for anything that's not part of (or a dependency of) your original query
Thanks for making it clear, I was definitely expecting the « get me everything » scenario.
I'm getting bit hard by aliases now, pathom is finding all kind of paths that are semantically incorrect for users, as I have a lot of one to one and one to many relationships involving user/id. I guess the remedy is to not keep things too flat after all
its tradeoff, but in general is better to avoid multiple paths if you have a preferred one
reducing OR nodes (by reducing the number of paths for a given attribute) in the planner will make things run smoother
These are accidental (and wrong). I'll try to make a minimal example tomorrow. For instance trying to get the users that are in a course by course/id, one of the path in the OR node will do it through purchases by course/id since it outputs purchase.user/id aliased to user/id
So it's semantically wrong since it's only the users that purchased a course not all the users in the course
yeah, its an important detail to be aware, if you have ambiguity in the path, better to avoid it, but I think its an important detail that we should talk more about it when flatening things
its good, but only when there is no ambiguity
if there is, it becomes a tricky land
lets think about the courses thing
my idea there would be to implement :course/users
for the users of a course, that depends on :course/id
, whats the way you have it?