apollographql / apollo-ios

📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.
https://www.apollographql.com/docs/ios/
MIT License
3.88k stars 727 forks source link

Inline GQL #1328

Open ericlewis opened 4 years ago

ericlewis commented 4 years ago

This might be old hat and I know it’s not a great issue but need to write down somewhere:

You should be able to describe fragments or query’s with inline strings as opposed to colocating with graphql files.

It probs seems minor but from a DX perspective the whole co-locating things a big deal.

Creating more folder structure to organize is less good than just having the query in a used component. This is probably more true of SwiftUI than anything, and I have some SwiftUI stuff to contribute if folks want it.

designatednerd commented 4 years ago

Hi! There's definitely some significant obstacles to this at the moment, particularly around how things are ingested for code generation. Right now, we only ingest from .graphql files rather than from any arbitrary file, and without having to worry about what is a Swift String that contains a GraphQL query or anything like that.

This is definitely an enhancement to consider for the long term, but I'll be honest, we've got way bigger problems to solve first.

RolandasRazma commented 4 years ago

don't see this happening to be fair, more likely would be some kind of DSL

designatednerd commented 4 years ago

Thats' an interesting idea - I think the main issues I see with it are a) How would we ensure that queries are valid? and b) How would we generate the classes necessary for parsing the result?

Definitely going to think on that when I get back to this issue though.

calvincestari commented 2 years ago

Hi 👋🏻 - we've taken this into consideration and decided to defer it to a future 1.x release. We're not rejecting nor closing this issue but it's not on the roadmap yet. If this issue is important to you please let us know in this issue and it will help with prioritization - thank you!

We've been discussing dynamic operations lately, i.e.: don't need an input file, and this would fit in line with that work.