Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for selecting types (inline fragments) #34

Open
positron opened this issue Jul 11, 2018 · 2 comments
Open

Add support for selecting types (inline fragments) #34

positron opened this issue Jul 11, 2018 · 2 comments

Comments

@positron
Copy link

I don't think it is possible to render the ... on Droid part of this query using what exists today.

query HeroForEpisode($ep: Episode!) {
  hero(episode: $ep) {
    name
    ... on Droid {
      primaryFunction
    }
  }
}

If I can, tell me how and I'll update the documentation if needed :-)

@madstap
Copy link

madstap commented Aug 31, 2018

As far as I can tell, this feature is not implemented. You can use this ugly hack though

(defn inline-fragment
  [type fields]
  [(keyword (str "... on " (name type))) fields])

(comment

  (require '[venia.core :as venia])

  (venia/graphql-query {:venia/queries [[:hero {:episode :A_NEW_HOPE}
                                         [:name
                                          (inline-fragment :Droid [:primaryFunction])]]]})

  ;=> "{hero(episode:A_NEW_HOPE){name,... on Droid{primaryFunction}}}"

  )

@err
Copy link

err commented May 21, 2020

desired helper made available via fc786c9 on #42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants