Comments (7)
Hi, for posterity, I have found an alternative method with graphql-transform-federation
which allows adding federation-related directives to the schema that the Neo4jGraphQL
generator does not know about.
Simply generate the schema as you would, and transform the schema as you're passing it to the ApolloServer
configuration, like this:
// Create ApolloServer instance that will serve GraphQL schema created above
// Inject Neo4j driver instance into the context object, which will be passed
// into each (autogenerated) resolver
const neoServer = new ApolloServer({
context: ({ req }) => ({ req, driver }),
schema: transformSchemaFederation(neoSchema.schema, {
Query: { extend: true },
User: {
extend: true, keyFields: ["userId"], fields: {
userId: { external: true },
}
}
}),
introspection: true,
});
This seems to work quite well. Thanks anyways for the initial idea,as it made me stumble into this alternative workaround.
from graphql.
Hey @SolarLiner, while it sounds like we maybe need to expose our resolvers, [@graphql-tools/utils](https://www.npmjs.com/package/@graphql-tools/utils) exposes a function
getResolversFromSchema` which you may be able to use to get our resolvers. Give it a go and let me know if it works?
from graphql.
Rough example of something which might work:
const { getResolversFromSchema } = require("@graphql-tools/utils");
const { mergeTypeDefs } = require("@graphql-tools/merge");
const { makeExecutableSchema } = require("@graphql-tools/schema");
const { Neo4jGraphQL } = require("@neo4j/graphql");
const { printSchema } = require("graphql");
const neoSchema = new Neo4jGraphQL({
typeDefs,
driver,
});
const someService = new ApolloServer({
schema: buildFederatedSchema([
{
typeDefs: printSchema(neoSchema.schema),
resolvers: getResolversFromSchema(neoSchema.schema),
},
]),
context: ({ req }) => {
return {
driver,
req,
};
},
});
from graphql.
(You may need to wrap printSchema(neoSchema.schema)
with gql()
for it work)
from graphql.
Being fairly new with GraphQL I had not even thought of looking into graphql-tools
. This seems to be promising, thank you!
from graphql.
Note, this only works if you do not extend any typedefs.
from graphql.
Has there been any movement on this (support for neo4j graphQL endpoints as a subgraph)? I see a couple of pretty stale projects that attempt to help? The example above doesn't work as you would need to include the federation schema fragment in the neo4j schema, but then the buildSubgraph complains that they are already defined.
from graphql.
Related Issues (20)
- Error: SortDirection values must be an object with value names as keys HOT 5
- Relationship connection querying ignores direction HOT 8
- Add back _on filters or provide a way to sort unions HOT 7
- Add new filters for String types to enable case-insensitive filtering HOT 1
- When a boolean parameter to a cypher directive is false NULL is inserted instead HOT 5
- The `empyInput` flag is ignored during creation. HOT 2
- Filters of `@authorization` directive are not taken into account for top-level aggregate queries HOT 5
- Objects fully defined by custom queries should not throw warnings about unresolved fields. HOT 4
- Connection filters on interface relationships do not use field aliases HOT 2
- Inject custom directives
- `@populatedBy` does not work in conjunction with `DateTime` data type: callback function is not called HOT 4
- Support for date math expressions when comparing date and time fields
- Subscriptions do not reliably return strings or numbers for ids HOT 2
- Parameter naming leads to error HOT 2
- Custom query names HOT 1
- Subscriptions don't support update_relationship
- Field with populatedBy directive should appears in UpdateInput or CreateInput when not defined in the operations HOT 8
- Cannot deactivate the top-level queries for unions HOT 10
- Export the Neo4jGraphQLError classes
- Add "filtering" and "sorting" support to fields that rely on custom resolvers HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql.