Code Monkey home page Code Monkey logo

Comments (2)

leebyron avatar leebyron commented on March 29, 2024

Sorry for the wait on this issue.

It looks like the issue is that your types are not well defined before running the schema. The assumption throughout the GraphQL engine is that once a GraphQLSchema is created, that it is sealed and immutable. This prevents issues where each run of a graphql execution could result in mutating the schema.

From your code sample here, it appears that calling ContentV1 probably produces a new instance of GraphQLObjectType which is created at runtime after the schema is created and sealed.

Ideally either this backend value is something that can be known when you boot your server, rather than per-request so that you can define it in as you assemble your GraphQL schema, or you should define it as part of the rootValue so that it's accessible from resolve functions throughout.

I'll ensure as we write documentation that we make it clear that once a GraphQLSchema is created, it's not to be altered.

from graphql-js.

charypar avatar charypar commented on March 29, 2024

I assumed immutability is the case. The only reason I did this was I didn't know about the ability to pass the execution context into a graphql call and use it in observers. Forgot to come back here and close it.

Hopefully this will come in handy to someone in the future. :)

from graphql-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.