This is the first time I’ve tried using apollo-ios-cli
to generate Swift packages for a couple of different APIs. To keep things simple, I’ll just deal with one of them, CommonGraphQL
.
I’ve got a configuration file that appears to work. I can fetch the schema and generate a Swift package using "moduleType" : { "swiftPackageManager" : {} }
.
I see all of the expected Swift files in the package tree at the root of my project.
I add this as a local package in Xcode and it shows fine in the project explorer.
However, when I try to build the app, I get file not found errors for every .graphql
files that was used to generate the Swift code. It’s also looking for those files in the root of the project, rather than where they reside.
I’m sure I’m missing something simple, so any help would be appreciated.
{
"schemaNamespace" : "CommonGraphQL",
"input" : {
"operationSearchPaths" : [
"./Sources/Common/GraphQL/**/*.graphql"
],
"schemaSearchPaths" : [
"./Sources/Common/GraphQL/**/*.graphqls"
],
},
"output" : {
"testMocks" : {
"swiftPackage" : {
}
},
"schemaTypes" : {
"path" : "./CommonGraphQL",
"moduleType" : {
"swiftPackageManager" : {
}
}
},
"operations" : {
"inSchemaModule" : {
}
}
},
"schemaDownloadConfiguration" : {
"downloadMethod": {
"introspection": {
"endpointURL": "https://foo.com/consumer-mobile/graphql",
"httpMethod": {
"POST": {}
},
"includeDeprecatedInputValues": false,
"outputFormat": "SDL"
}
},
"downloadTimeout": 60,
"headers": [],
"outputPath": "./Sources/Common/GraphQL/schema/CommonSchema.graphqls"
},
"options": {
"queryStringLiteralFormat": "multiline",
"schemaDocumentation": "include",
"apqs": "disabled",
"cocoapodsCompatibleImportStatements": false,
"warningsOnDeprecatedUsage": "include",
"conversionStrategies": {
"enumCases": "camelCase"
},
"pruneGeneratedFiles": true
}
}