GithubHelp home page GithubHelp logo

Comments (6)

armanbilge avatar armanbilge commented on July 29, 2024

Looks like for some reason this case is not matching, and it's proceeding to the next one, where it crashes.

case Select(name, _, Select(fieldName, _, _)) if fieldName.startsWith("subquery") =>

from clue.

armanbilge avatar armanbilge commented on July 29, 2024

So I've been staring at this one, and actually I am not sure if it's supposed to workโ€”at least not in general. I think the issue is this bit:

... on Gcal $GcalStepConfigSubquery

I have a recollection that we discussed at one point, how fragments and subqueries actually do not mix. Because in the general case fragments are actually defining a new result type (that would not match the subquery's type).

e.g. in this example, fragments are creating a new result type that includes name. If on Droid or on Human was a subquery, it would not include name and thus those datatypes cannot be used.

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

If my analysis is correct, then I think we should consider:

  1. arguably this is a special case, since you are only expanding a single fragment with no other fields. So should it get special treatment?
  2. otherwise this probably deserves a nicer error message :)

Thoughts?

from clue.

rpiaggio avatar rpiaggio commented on July 29, 2024

You are totally right. Interface queries don't necessarily materialize into an instance. We should extract a subquery on the actual instantiated type (hero in your example).

We could still define reusable blocks for these cases (ie: special case), and I think it would be just a string with the subquery (no output type or decoder), only that we would have to resolve the interpolation at compile time, like we do for actual subqueries. I wonder if this is worthwhile, thoughts? Do you think this it's straightforward or that I'm missing something?

from clue.

armanbilge avatar armanbilge commented on July 29, 2024

We could still define reusable blocks for these cases (ie: special case), and I think it would be just a string with the subquery (no output type or decoder), only that we would have to resolve the interpolation at compile time, like we do for actual subqueries.

Oh, I see! So in this case, we just want to interpolate the string part of the query, and not share/reuse data classes? Did I understand correctly?

from clue.

rpiaggio avatar rpiaggio commented on July 29, 2024

Oh, I see! So in this case, we just want to interpolate the string part of the query, and not share/reuse data classes? Did I understand correctly?

Yes, that's what I mean. In other words, compile-time concatenation. It might be useful too when there are common fields but not a common interface. WDYT?

from clue.

armanbilge avatar armanbilge commented on July 29, 2024

Yes, I do think that would be useful! I actually attempted that when I first started working on subqueries, because I assumed it would be helpful. It turned out to be difficult and not strictly needed ๐Ÿ˜‚

I still have the branch lying around, I can give it another shot :) the strategy I was trying to use there, was that the Scala compiler will automatically concatenate final val strings at compile time. So I was hoping we could tap into that somehow.
https://github.com/gemini-hlsw/clue/commits/pr/final-val-document

from clue.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.