Hi there, I am using Cocoapods to import the Apollo iOS client into my native iOS project.
I am using the following schema but getting a 400 when hitting my endpoint:
{
"schemaNamespace" : "<name >",
"schemaDownload": {
"downloadMethod": {
"introspection": {
"endpointURL": "some.url/graphql",
"httpMethod": {
"GET": {}
},
"includeDeprecatedInputValues": false,
"outputFormat": "JSON"
}
},
"downloadTimeout": 60,
"headers": {
"Allow-Introspection": true
},
"outputPath": "./graphql/"
},
"input" : {
"operationSearchPaths" : [
"**/*.graphql"
],
"schemaSearchPaths" : [
"**/schema.json"
]
},
"output" : {
"testMocks" : {
"none" : {
}
},
"schemaTypes" : {
"path" : "./GeneratedFiles",
"moduleType" : {
"other" : {}
}
},
"operations" : {
"inSchemaModule" : {
}
}
},
"options": {
"cocoapodsCompatibleImportStatements": true
}
}
Based on my observation, the endpoint I am hitting is expecting a GET
method to introspect, however it seems the ./Pods/Apollo/apollo-ios-cli
is expecting a queryParameterName
as per error:
Error: keyNotFound(
GETCodingKeys(stringValue: "queryParameterName", intValue: nil),
Swift.DecodingError.Context(
codingPath: [
CodingKeys(stringValue: "schemaDownload", intValue: nil),
CodingKeys(stringValue: "downloadMethod", intValue: nil),
CodingKeys(stringValue: "introspection", intValue: nil),
IntrospectionCodingKeys(stringValue: "httpMethod", intValue: nil),
CodingKeys(stringValue: "GET", intValue: nil)
],
debugDescription: "No value associated with key GETCodingKeys(stringValue: \"queryParameterName\", intValue: nil) (\"queryParameterName\").",
underlyingError: nil
)
)
If I do pass a parameter like "GET": { "queryParameterName": "foo" }
, I get the following: Error: Received bad response from server (code 404): Optional("")
Speaking to my backend team, it seems that usually you’d get a 400 if a header is missing to allow introspection: Allow-Introspection
, but as you can see in my config above I am passing that value in
Is this expected?