-
Notifications
You must be signed in to change notification settings - Fork 50
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
Initial Setup iOS SPM #49
Comments
Hmm... I've found the logs in Xcode that show I'm still hitting on the error with the test schema files and types causing issues. I saw this comment... apollographql/apollo-ios#2543 (comment) But I don't have a |
OK, I got past that I think. All our code files live inside |
Ah ok, I'm getting closer. From this comment... apollographql/apollo-ios#2543 (comment) It looks like the docs tell you to download the schema in JSON but the generated file starts looking for Now it's telling me "The schema definition is not executable". I could chmod it but it's a JOSN file and I'm not sure that's what it means? 🤔 |
Hey @oliverfoggin, there's a couple things here I can help with
Our documentation can certainly improve and better illustrate all things needed in order to begin. Thanks for the feedback.
It's not incorrect but I think it should be changed to guide users to download the SDL format file, it's far more human-readable and works well with the config file defaults.
Think of it this way
Code generation can either be configured and executed through code in a standalone macOS project, or using the CLI which requires the use of the JSON configuration file.
Apollo Studio supports downloading in either JSON or SDL format. SDL files typically have the
Sounds like you may not have any operations defined? A schema defines what is possible via the API, but your operations define what it is you actually want. |
We can continue the conversation here but I'm going to close this as it's not a bug or feature request, etc. |
Thanks for the replies to this. I think a lot of this will definitely help. I'll be working on this again today so hopefully I'll be able to get moving on it 😄 Thanks |
I got a generated file! Thanks for your help! The key things were switching to the SDL schema, and creating a query (but then also pointing the config file to the correct places). Thanks @calvincestari |
I feel like I'm very close to getting this working now. However, after getting the types and stuff generated I'm getting a compile error in the Apollo package itself...
This is in files like |
Looks like you got this working, from what I can read in your community post.
Code generation does support JSON-based schema files, you will need to update the |
@calvincestari thanks, I'll make sure to keep that in mind for the future. One thing I have noticed when using the SDL file is that it seems to be references in the docs as I've got it working with this but I had to update the config to use the correct path and file extension. Thanks |
That is a quirk of Apollo Studio. We should add a note about that to the Apollo iOS documentation. |
I've been trying to work with the Getting Started documentation here... https://www.apollographql.com/docs/ios/get-started
But I'm struggling to work out what I need to do. I don't have any experience with setting up any GraphQL API and I feel like the docs assume quite a bit of knowledge. Either that or there are possibly missing a few steps?
I don't yet have a schema for the project we're working on. I'm just involved in the initial exploration of the Apollo SDK in the project and so I decided to use the StarWars schema mentioned here... https://www.apollographql.com/docs/ios/code-generation/downloading-schema
It mentions using the drop down menu on the right of the Apollo Studio screen to download the
JSON
file rather than theraw
file.But then it drops any mention of using the Star Wars schema. I have a
[email protected]
file in my project but I'm not sure what to do with it.It says to run this line...
swift package --allow-writing-to-package-directory apollo-initialize-codegen-config --schema-name ${MySchemaName}
... Should I be using the downloaded star wars file to find the schema name? Isstar-wars-swapi
the schema name? Or is the schema name contained inside that file?I also have an
apollo-codegen-config
file. But I'm also not sure what to do with that.I've added the
apollo-ios-cli
to the package and I can right click and see theinitialise
,fetch
,generate
options but they don't seem to do anything.I'm trying to follow the instructions for using a
Package.swift
file with SPM rather than doing it through Xcode.I have a package and target in the SPM package called
GraphQL
located at./Sources/GraphQL
.I'm stuck right now with trying to get hold of a
.graphql
or.graphqls
file. I think I'm supposed to have some of those in the project but I can't find where I am supposed to get them from.Thanks
The text was updated successfully, but these errors were encountered: