graphql
graphql copied to clipboard
Is there anyway to integrate graphql-middleware?
I know that this is not necessarily the right channel for this, but I don't think the slack channel is appropriate either, so I think the gql ogm team will be of greatest help in this regard.
What I'm wondering is if there is anyway to get a schema back from the OGM?
I assume it generates a schema with the typeDefs under the hood, but is there someway to inject your own schema into the OGM?
My use case is I want to wrap all OGM calls with a retry + logger on retry failure using graphql-middleware.
Anyway, sorry if this isn't the right place to put the question, but I really appreciate your time!
Love this package, Aaron
Why do you need to use the OGM instance when you can get a schema back from the Neo4JGraphQL class?
const neoSchema = new Neo4JGraphQL({ ... })
const schema = await neoSchema.getSchema()
const middlewares = [{
Query: {}
}]
const wrappedSchema = applyMiddleware(schema, ...middlewares)
Sorry, my question was poorly worded!
We use the OGM in certain parts of our code base and have a GQL server. I have the GQL server middleware setup, but for the sake of consistency and the benefit the middleware provides, I was hoping there is a way to inject middleware into the OGM's schema. (Assuming that the OGM uses a graphql schema, which presumably it does bc of the need to pass in typedefs.)

I've been exploring the code, but haven't attempted playing with it yet... I think I get the gist of it, but I'm sure there's a lot of edge casey stuff w/ respect to it.
If I gave the OGM constructor a second param, with the second param being called middleware, and then used applyMiddleware(schema, middleware) before setting the schema on the class, do you know off the top of your head if it would explode?
If I were to make this modification and submit a PR with tests passing, what would the likelihood of such an extension being approved be?