Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Schema(s) #7

Closed
dbettin opened this issue Jan 4, 2017 · 5 comments
Closed

Dynamic Schema(s) #7

dbettin opened this issue Jan 4, 2017 · 5 comments

Comments

@dbettin
Copy link

dbettin commented Jan 4, 2017

  • Are there plans to support the schema language?
  • Is it possible to generate a schema dynamically?
@mhallin
Copy link
Member

mhallin commented Jan 6, 2017

Hello!

I haven't given much thought to the schema language. What would be your use case for schema language support? Are there any tools that produce or consume this representation?

What do you mean with "generate a schema dynamically"? All exposed types today must implement the GraphQLType trait, which means that a schema is fixed at compilation time.

@Mange
Copy link

Mange commented Jan 9, 2017

Some people respond with different schemas depending on auth context and whatever. Maybe @dbettin is referring to that?

@dbettin
Copy link
Author

dbettin commented Jan 9, 2017

We are planning to build graphql schema designers. These schemas could live in a database for example. So they would not be able to be statically defined in code.

@mhallin
Copy link
Member

mhallin commented Jan 15, 2017

I see. Unfortunately, I don't think this library is suited for that use case. In order to do this with Juniper, you would need to bypass all functionality provided by implementing the GraphQLType trait. It would be possible to build a meta-model of the schema using the API in https://github.com/mhallin/juniper/blob/master/src/schema/meta.rs, but you would need to implement a custom query executor that only relied on your database model.

To answer @Mange's question, that should be possible by using different RootNode instances depending on e.g. auth context.

@dynaxis
Copy link

dynaxis commented Apr 14, 2020

@dbettin so could you share me which route you took for your case? I have a similar requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants