Fork me on GitHub
#pathom
<
2020-02-26
>
ouvasam09:02:21

Hi, Why do i have "Key must be an Integer" error when doing something like :

(<!! (parser {} [{([:catalogue/id 1] {:where {:a 1}})
                   [:catalogue/name
                    :catalogue/status]}])))

ouvasam09:02:26

using this :

(<!! (parser {} [{'(:catalogues {:where {:a 1}})
                   [:catalogue/name
                    :catalogue/status]}])))
I can get the params with (`get-in env [:ast :params])` but when using it with
(<!! (parser {} [{'([:catalogue/id 1] {:where {:a 1}})
                   [:catalogue/name
                    :catalogue/status]}])))

ouvasam09:02:42

i can't get the params ?

ouvasam09:02:39

I also don't understand why i should quote the query ?

ouvasam10:02:19

I found that pathom/context work with that second case as this

(<!! (parser {} [{'([:catalogue/id 1] {:pathom/context {:where {:a 1}}})
                   [:catalogue/name
                    :catalogue/status]}])))
I can have params with (p/entity env) bu this does not work with the first example
(<!! (parser {} [{'(:catalogues {:pathom/context {:where {:a 1}}})
                   [:catalogue/id
                    :catalogue/name]}]))) 

sif11:02:46

Maybe if you are using fulcro template there is plugin that moves params under query-params in env

ouvasam12:02:55

Thanks @U0MK9B06T i can get params with (:com.wsscode.pathom.core/root-query env) but i wonder if it 's the good way to access it ? I don't use fulcro no

ouvasam10:02:41

What do i miss here ?

eoliphant18:02:05

Hi I was just curious about how folks are organizing their namespaces to best take advantage of prefixing and what have you. as one of my codebases has grown, we’ve taken breaking it up functionally,and making it more or less ‘clean’ with something like domain.concept.core (cljc) domain.concept.resolvers (clj[s]) etc,. we’d just been sticking specs for say :domain.concept/foo in the core ns, but recently added an empty domain.concept ns so that we can ::dc/foo and what have you. it seems more convenient, but just feels weird having the empty ns around just for the sake of naming.

Chris O’Donnell20:02:09

I've adopted the same pattern, though I also include spec and coercion logic in the domain.concept.core namespace.

mavbozo04:02:57

we also have empty ns around just for naming attributes for domain specific data. e.g. net.zenius.content so that we can use shorthand ::content/name , ::content/id etc

ak-coram09:02:56

All the namespaces I use with pathom are empty, so it doesn't feel weird to me. I create them with create-ns and have a macro for defining a consistent set of aliases for them.

eoliphant13:02:25

Thanks for the responses, and totally forgot about create-ns.