ApolloServer with gateway and typeDefs + resolvers

is there a way I can create ApolloServer with the gateway param and typeDefs+resolvers at the same time?

I have a federated supergraph gateway which is working great, but recently I have a 3rd party service which only supports REST so I need to have a way to query it via the gateway as well.

Either works fine individually (only gateway or only typeDefs+resolvers) but togerher it does not work… so I can either use the federated supergraph or I can use custom resolvers where I can direct the query as I want to the REST endpoint … but I can’t seem to make it work together at the same time …

How could I inject the custom resolvers to the federated gateway? or any other way I can intercept a specific query/mutation (schema) to control the request and transform to the REST?

I am using these dependencies:

  "dependencies": {
    "@apollo/client": "^3.6.9",
    "@apollo/federation": "^0.36.1",
    "@apollo/gateway": "^0.46.0",
    "@apollo/subgraph": "^0.4.2",
    "@graphql-tools/links": "^8.3.9",
    "@graphql-tools/schema": "^8.5.1",
    "@graphql-tools/stitch": "^8.7.10",
    "@graphql-tools/utils": "^8.12.0",
    "@graphql-tools/wrap": "^8.5.1",
    "apollo-datasource-rest": "^3.7.0",
    "apollo-graphql": "^0.9.7",
    "apollo-server": "^3.6.7",
    "apollo-server-types": "^3.5.2",
    "express": "^4.18.1",
    "express-graphql": "^0.12.0",
    "graphql": "^15.8.0",
.... and more but unrelated to this issue

Hey there @Frantisek_Koudelka,

I’d like to understand more about the REST endpoint you’re trying to integrate. Are you implementing this with the RESTDataSource class? This should abstract away the need to intercept the queries at build time. If you could share a minimal replication and the errors you see, that will also help determine the cause.

sure let me put something quick together …