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

Enrich schema at runtime dynamically #661

Closed
benlammel opened this issue Feb 28, 2021 · 3 comments
Closed

Enrich schema at runtime dynamically #661

benlammel opened this issue Feb 28, 2021 · 3 comments

Comments

@benlammel
Copy link

I was wondering if it is possible to enrich the schema at runtime dynamically.

Scenario:
multi-tenancy environment.
Tenant is identified by path param (uri) or value/variable in query.

Every tenant has the same basic "hard coded" schema artefacts but can create/model more types (therefore also query and mutation ops) dynamically, which are saved in a dedicated data storage.

So, the schema needs to be rebuilt dynamically (without restarting) for every tenant at the time of querying.
Of corse, just rebuilding if something has changed (timestamp) otherwise take the cached one.

As what I have seen in the code so far, the schema is built at boot time and does not have a hook for extending it at run/query time.
I also checked the experimental events, but they're also just covering schema manipulation at boot time.

Any chance that this scenario could be picked up?

Thanks & cheers!

@t1
Copy link
Collaborator

t1 commented Feb 28, 2021

I guess adding a fully dynamic schema would be very difficult to build in, as smallrye-graphql binds to Java classes; so also the execution would need to be routed differently. This is a completely different concept.

Maybe it would be better to write something based directly on graphql-java or so.

OTOH it might be possible that your use-case could be served with GraphQL Federation, which we plan to support as downstream services (#521).

@benlammel
Copy link
Author

thanks for your reply. I totally understand that this follows a different concept.
I'll definitely subscribe to the federation enhancement.

@phillip-kruger
Copy link
Member

You can get hold of the underlying graphql-java and try and do it there. Or if everything is dynamic, just use that.

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

3 participants