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

Make it easier to create a custom GraphQlSource #1086

Open
rq-trichins opened this issue Nov 13, 2024 · 1 comment
Open

Make it easier to create a custom GraphQlSource #1086

rq-trichins opened this issue Nov 13, 2024 · 1 comment
Labels
type: enhancement A general enhancement
Milestone

Comments

@rq-trichins
Copy link

I would like to create a custom GraphQlSource so that I can change out the GraphQlSchema based on user privileges (show one schema for admins and another schema for non-admins). Right now, the GraphQlSource created in GraphQlAutoConfiguration is always a FixedGraphQlSource. I can override the bean, but I have to copy all the code in GraphQlAutoConfiguration if I want the same functionality that already exists.

It would be nice if there was a way to have GraphQlAutoConfiguration create a non FixedGraphQlSource. One possible idea is to not have it call GraphQlSource.schemaResourceBuilder() but instead have that be a bean that can then be overridden. Or add a customizer that can take the generated FixedGraphQlSource and generate a custom GraphQlSource based on it.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 13, 2024
@rstoyanchev
Copy link
Contributor

rstoyanchev commented Nov 15, 2024

You could use a BeanPostProcessor to decorate the GraphQlSource bean.

That said, the original idea with GraphQlSource was to be a point of flexibility, so we could provide a more first-class way to choose the implementation by decorating the simple FixedGraphQlSource through a method like this on GraphQlSource.Builder:

Builder extendGraphQlSource(Function<GraphQlSource, GraphQlSource> processor);

@rstoyanchev rstoyanchev added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 15, 2024
@rstoyanchev rstoyanchev added this to the 1.4.x milestone Nov 15, 2024
@rstoyanchev rstoyanchev changed the title Make it easier to create a non FixedGraphQlSource Make it easier to create a custom GraphQlSource Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants