Support multiple independent roots #186
Replies: 11 comments 1 reply
-
@RichoDemus Currently it just exposes one GraphQL Servlet on one endpoint. To be able to do this would require some work, and you might run into a couple of challenges while doing so. You need to create a @Bean
@ConditionalOnBean({GraphQLResolver.class})
@ConditionalOnMissingBean
public SchemaParser schemaParser(
List<GraphQLResolver<?>> resolvers,
SchemaStringProvider schemaStringProvider,
PerFieldObjectMapperProvider perFieldObjectMapperProvider
) See You probably could use the same approach, having a similar method where at least all Then you can use those @Bean
public ServletRegistrationBean<AbstractGraphQLHttpServlet> api1(AbstractGraphQLHttpServlet servlet) {
return new ServletRegistrationBean<>(servlet, "/api/v1");
}
@Bean
public ServletRegistrationBean<AbstractGraphQLHttpServlet> api2(AbstractGraphQLHttpServlet servlet) {
return new ServletRegistrationBean<>(servlet, "/api/v2");
} One way would be to start by configuring |
Beta Was this translation helpful? Give feedback.
-
Closing this issue due to inactivity. |
Beta Was this translation helpful? Give feedback.
-
One approach that I believe is suitable in this case is to package the apps as WAR's and deploy them separately. If you build the war's in the same project they can share the modules and most of the code and benefit form isolated deployment since WAR's are 'standalone' apps. |
Beta Was this translation helpful? Give feedback.
-
@oliemansm : We reached this issue/thread again and it's a functionality that I think it is useful. Also, what are your conditions / requirements for the patch so I can take them into consideration. |
Beta Was this translation helpful? Give feedback.
-
+1 for this functionality. It would be very useful for different escenarios including api versioning. Configuration should be simple, like @RichoDemus example. I think the schemas folder and servlet mappings can be set in the application properties file. |
Beta Was this translation helpful? Give feedback.
-
Would be really helpful to have this feature on board. |
Beta Was this translation helpful? Give feedback.
-
Reopening the issue seeing the popularity of the request. @ieugen Thanks for offering to help out here. We're very short handed so any support is appreciated. The basic principles mentioned by @gchiappe seem like a good starting point. The WARs approach doesn't immediately come to mind to me since that implies certain consequences regarding deployment, making it potentially incompatible (unless I'm totally misunderstanding your proposed solution here). |
Beta Was this translation helpful? Give feedback.
-
Hi @oliemansm , I'm not currently working on with GraphQL or this library so I won't be available to help. The WAR approach is to build 2 apps that share jar files (code). |
Beta Was this translation helpful? Give feedback.
-
Hi, are there any plans to implement this? It would be quite a useful feature. @oliemansm your suggestions seems reasonable, but I still wouldn't know how to approach this effectively... |
Beta Was this translation helpful? Give feedback.
-
Just a comment to this if you need two endpoints with the same schema, it's possible to add additional url mappings to one servlet. @Bean
public ServletRegistrationBean<AbstractGraphQLHttpServlet> graphQlServletRegistration(AbstractGraphQLHttpServlet servlet) {
var servletBean = new ServletRegistrationBean<AbstractGraphQLHttpServlet>(servlet, servletGraphQlMapping);
servletBean.addUrlMappings(nonAuthorizedGraphqlPath);
return servletBean;
} |
Beta Was this translation helpful? Give feedback.
-
any news ? |
Beta Was this translation helpful? Give feedback.
-
I want to be able to deploy multiple roots in different paths, like this:
http://localhost/api/v1/ -> resources/api/v1/queyr.graphqls
http://localhost/api/v2/ -> resources/api/v2/queyr.graphqls
and then also have different query resolvers as well.
If this is already possible then if someone can tell me how I can open a PR to update the documentation
Beta Was this translation helpful? Give feedback.
All reactions