Fork me on GitHub
#pathom
<
2020-10-18
>
thomasmoerman21:10:47

@wilkerlucio I added a comment to this (closed) issue, I have the impression that union queries for the parallel parser are still broken, or i'm doing something wrong: https://github.com/wilkerlucio/pathom/issues/160

wilkerlucio23:10:09

thanks, I’ll have a look on it tomorrow

yenda10:10:58

@wilkerlucio also related, when trying to use join-seq in a resolver for a union query, I have to use a weird workaround: https://clojurians.slack.com/archives/C87NB2CFN/p1602448785082500

wilkerlucio18:10:16

@U052A8RUT sent a comment there

wilkerlucio18:10:41

@U0DB715GU I understand this a pain at the moment, one idea I have to go around is to make a ::p/union-path that is smarter and can do both (the default and yours, depending on the context), you can use information from env to decide the context, maybe you change depending on the ::p/path, makes sense?

thomasmoerman19:10:14

@wilkerlucio I answered with an example that triggers the problem

wilkerlucio19:10:02

hello, I tried with to many with this:

wilkerlucio19:10:04

(pc/defresolver input-group=>cases-union
  [_ {:nexus.project/keys     [historic-cases]
      :nexus.input-group/keys [id] :as input}]
  {::pc/docstring "Resolve Cases by InputGroup, union query."
   ::pc/input     #{:nexus.input-group/id
                    :nexus.project/historic-cases}
   ::pc/output    [{:nexus.input-group/cases-union [:nexus.case.image-annotation/id
                                                    :nexus.case.test-case/id]}]}
  {:nexus.input-group/cases-union [{:nexus.case.image-annotation/id 1}
                                   {:nexus.case.test-case/id 1}]})

(def debug-parser
  (p/parallel-parser
    {::p/env     {::p/reader               [p/map-reader
                                            pc/parallel-reader
                                            pc/open-ident-reader
                                            p/env-placeholder-reader]
                  ::p/placeholder-prefixes #{">"}}
     ::p/mutate  pc/mutate-async
     ::p/plugins [(pc/connect-plugin {::pc/register [input-group=>cases-union
                                                     (pc/constantly-resolver :nexus.project/historic-cases "foo")]})
                  p/error-handler-plugin
                  p/trace-plugin]}))

(comment
  (async/<!! (debug-parser {}
     [{[:nexus.input-group/id 1]
       [{:nexus.input-group/cases-union {:nexus.case.image-annotation/id [:nexus.case.image-annotation/id
                                                                          :cmmn.case/id
                                                                          :cmmn.case/name]
                                         :nexus.case.test-case/id        [:nexus.case.test-case/id
                                                                          :cmmn.case/id
                                                                          :cmmn.case/name]}}]}])))

wilkerlucio19:10:31

it still worked, Im wondering what is triggering the error validation (I'm using with guardrails on here too, but not triggering the error)