.graphql:1:error:Unknown type \"Int\"."]

Hello, I tried to Apollo 1.0.1 for my project trying with the both options spm and manual. I encounter the same problem. Here is the my apollo-codegen-config.json

{
  "schemaName" : "schema.json",
  "schemaDownloadConfiguration": {
    "downloadMethod": {
        "introspection": {
            "endpointURL": "https://swapi-graphql.netlify.app/.netlify/functions/index",
            "httpMethod": {
                "POST": {}
            },
            "includeDeprecatedInputValues": false,
            "outputFormat": "SDL"
        }
    },
    "downloadTimeout": 60,
    "headers": [],
    "outputPath": "./schema.json"
},
  "input" : {
    "operationSearchPaths" : [
      "./*.graphql"
    ],
    "schemaSearchPaths" : [
      "./*.graphqls"
    ]
  },
  "output" : {
    "testMocks" : {
      "none" : {
      }
    },
    "schemaTypes" : {
      "path" : "./MySchemaName",
      "moduleType" : {
        "swiftPackageManager" : {
        }
      }
    },
    "operations" : {
      "relative" : {
      }
    }
  }
}

and here is the my graphql query

query AllFilms($first: Int) {
  allFilms(first: $first) {
    films {
      title
    }
  }
}

I counter the this problem: .graphql:1:error:Unknown type "Int"."]

It’s likely that your schema file is not being picked up by the code gen engine. (We are working on providing better error messages for this case soon!)

Make sure that the schemaSearchPaths is set correctly in your config to pick up your schema. If you are using a json schema, you will want to add the schema with the correct extension (.json instead of .graphqls) to your config.

Thanks for your response, i solved the problem using the SPM. Now i encounter the different problem. I generated the query but the new .graphql.swift file gives me errors.

  • Type ‘Objects’ has no member ‘RepositoryConnection’
  • Module ‘API’ has no member named ‘URI’
  • No type named ‘URI’ in module ‘API’

@Ebubekir have you checked if there is actually a URI type in your project? It looks like it may be a custom scalar.

Actually URI type comes from the generated API Query. It does not exist in the codes