also, https://pathom3.wsscode.com/docs/smart-maps/#error-modes
Is there an equivalent of ::psm/error-mode-loud
for eql?
in pathom3 are params different from eql? Here I'd expect :param to be available in the resolver.
(edn-query-language.core/query->ast
['({[:thing/id #uuid "c5aa81d4-13cf-491d-ac83-3646c9e0bc0b"]
[:thing/attr]} {:param "param for thing"})])
;; => {:type :root, :children [{:type :join, :dispatch-key :thing/id, :key [:thing/id #uuid "c5aa81d4-13cf-491d-ac83-3646c9e0bc0b"], :query [:thing/attr], :children [{:type :prop, :dispatch-key :thing/attr, :key :thing/attr}], :params {:param "param for thing"}, :meta {:line 251, :column 4}}]}
(pco/defresolver resolver-using-param [env _]
{::pco/input [:thing/id]
::pco/output [:thing/attr]
::pco/params [:param]}
{:thing/attr (str "attr with " (:param (pco/params env)))})
(resolver-using-param
{}
['({[:thing/id #uuid "c5aa81d4-13cf-491d-ac83-3646c9e0bc0b"]
[:thing/attr]} {:param "param for thing"})])
not a bug per-see, but an error in expectation, but its such a common one that I'm considering a way to give an easy fix, I see a lot of people doing plugins that just move the params forward everywhere, I think that's overkill, but I also think it could be something like "forward ident params", to move just params from idents to the first level of things
That might be a nice extension, but if that somehow pollutes the params idea maybe a "global params" thing in the env would be better. That's what :params
means in this case I think?
I tried updating from pathm 2.3.0 alpha 10 to 21 and I got a validation error in one of my resolver. it's responding to a union query and used to work fine so I don't understand the error. This is what it prints:
[{:follows-threshold [:notification/type :notification/timestamp :notification/text], :follow [:notification/type :notification/timestamp :user/id], :comment [:notification/type :notification/timestamp :comment/text :user/id :video/id], :comment-reply [:notification/type :notification/timestamp :comment/text :user/id :video/id], :like [:notification/type :notification/timestamp :user/id :video/id :video/deleted?], :video-uploaded [:notification/type :notification/timestamp :notification/text :video/id], :views-threshold [:notification/type :notification/timestamp :notification/text :video/id], :likes-threshold [:notification/type :notification/timestamp :notification/text :video/id]}] - failed: keyword? in: [:com.wsscode.pathom.connect/output 1] at: [:com.wsscode.pathom.connect/output :attribute-list :plain] spec: :edn-query-language.core/property
[{:follows-threshold [:notification/type :notification/timestamp :notification/text], :follow [:notification/type :notification/timestamp :user/id], :comment [:notification/type :notification/timestamp :comment/text :user/id :video/id], :comment-reply [:notification/type :notification/timestamp :comment/text :user/id :video/id], :like [:notification/type :notification/timestamp :user/id :video/id :video/deleted?], :video-uploaded [:notification/type :notification/timestamp :notification/text :video/id], :views-threshold [:notification/type :notification/timestamp :notification/text :video/id], :likes-threshold [:notification/type :notification/timestamp :notification/text :video/id]}] - failed: map? in: [:com.wsscode.pathom.connect/output 1] at: [:com.wsscode.pathom.connect/output :attribute-list :composed] spec: :com.wsscode.pathom.connect/out-attribute
[:pagination/edges [{:follows-threshold [:notification/type :notification/timestamp :notification/text], :follow [:notification/type :notification/timestamp :user/id], :comment [:notification/type :notification/timestamp :comment/text :user/id :video/id], :comment-reply [:notification/type :notification/timestamp :comment/text :user/id :video/id], :like [:notification/type :notification/timestamp :user/id :video/id :video/deleted?], :video-uploaded [:notification/type :notification/timestamp :notification/text :video/id], :views-threshold [:notification/type :notification/timestamp :notification/text :video/id], :likes-threshold [:notification/type :notification/timestamp :notification/text :video/id]}] :pagination/has-prev? :pagination/has-next? :pagination/first-cursor :pagination/last-cursor] - failed: map? in: [:com.wsscode.pathom.connect/output] at: [:com.wsscode.pathom.connect/output :union] spec: :com.wsscode.pathom.connect/output
@yenda this union is malformed, for unions you should put the {}
right after the join, without the []
, as:
::pc/output [:pagination/edges {:follows-threshold [:notification/type
:notification/timestamp
:notification/text]
:follow [:notification/type
:notification/timestamp
:user/id]
:comment [:notification/type
:notification/timestamp
:comment/text
:user/id
:video/id]
:comment-reply [:notification/type
:notification/timestamp
:comment/text
:user/id
:video/id]
:like [:notification/type
:notification/timestamp
:user/id
:video/id
:video/deleted?]
:video-uploaded [:notification/type
:notification/timestamp
:notification/text
:video/id]
:views-threshold [:notification/type
:notification/timestamp
:notification/text
:video/id]
:likes-threshold [:notification/type
:notification/timestamp
:notification/text
:video/id]}
:pagination/has-prev?
:pagination/has-next?
:pagination/first-cursor
:pagination/last-cursor]
the parameter seems out of place in the query
try like this:
(edn-query-language.core/query->ast
['{[:thing/id #uuid "c5aa81d4-13cf-491d-ac83-3646c9e0bc0b"]
[(:thing/attr {:param "param for thing"})]}])
I can't understand from this, can you send the resolver output that's failing?
::pc/output [:pagination/edges [{:follows-threshold [:notification/type
:notification/timestamp
:notification/text]
:follow [:notification/type
:notification/timestamp
:user/id]
:comment [:notification/type
:notification/timestamp
:comment/text
:user/id
:video/id]
:comment-reply [:notification/type
:notification/timestamp
:comment/text
:user/id
:video/id]
:like [:notification/type
:notification/timestamp
:user/id
:video/id
:video/deleted?]
:video-uploaded [:notification/type
:notification/timestamp
:notification/text
:video/id]
:views-threshold [:notification/type
:notification/timestamp
:notification/text
:video/id]
:likes-threshold [:notification/type
:notification/timestamp
:notification/text
:video/id]}]
:pagination/has-prev?
:pagination/has-next?
:pagination/first-cursor
:pagination/last-cursor]