I am building an MVP on top of the GRAND Stack and as long as we deal with neo4J / GraphQL, things were relatively easy and we already manage > 100 relations between several dozens of nodes. The central data schema gradually approaches 1K LoC and, so far, it runs surprisingly stable and hassle-free in development and testing.
There are just two REST API calls, both POST, and to integrate them, I did the following:
- Replicated the JSON spec's as GraphQL Schema
- Wrote a RESTData Source with the required authentication headers
- Wrote custom resolver
- Added custom resolver to as parameter to makeAugmentedSchema
- Added RestDataSource to Apollo Server
However, when I run the query, I get a proper JSON / REST response logged to the console but the GraphQL return type remains null(!) means for some strange reason there is no matching between the REST return type and the GraphQL type. In Playground, a non-nullable error is thrown, which is kinda expected when trying to return something from a null entity. However, I just cannot figure out how exactly to match the REST return to the GraphQL type.
I made a striped down sandbox for reproducing the issue. Any help or advice of how to integrate these two REST endpoints is most appreciated because I am totally stuck:-(
Also, is there a better way to do REST integration?
type or paste code here