Skip to content

SDL support for OSGi servlet #143

Open
@sergehuber

Description

@sergehuber

It would be nice to add SDL (https://www.graphql-java.com/documentation/v11/schema/) support to the GraphQL Java Servlet project. But this might also imply having a way to provide "parts" of SDL as well as Data Fetchers (TypeProviders should be ok) in a pluggable way (to stay compatible with OSGi notably).

Activity

oliemansm

oliemansm commented on Feb 16, 2019

@oliemansm
Member

@sergehuber Not sure I quite follow you here. This servlet is a wrapper around graphql-java and therefore provides support for this. When used in combination with graphql-java-tools you get automatic parsing of SDL found on the class path. So what it is exactly that you would like to be able to do which you can't right now?

sergehuber

sergehuber commented on Feb 16, 2019

@sergehuber
ContributorAuthor

I wasn't aware this was possible. So basically I need to provide a schema Provider that uses graphql-java-tools?

I thought SDL was directly supported by graphql-java or did I misunderstand there? it seems they have a SchemaParser available ? https://www.graphql-java.com/tutorials/getting-started-with-spring-boot/#schema

Regards,
Serge...

oliemansm

oliemansm commented on Feb 16, 2019

@oliemansm
Member

Well you don't have to use graphql-java-tools, you can use the SchemaParser from graphql-java directly. So the way to use it in combination with graphql-java-servlet would be to first create a GraphQLSchema with that SchemaParser from graphql-java and then pass that in to create the servlet using GraphQLHttpServlet.with(schema).

Does that answer your question?

sergehuber

sergehuber commented on Feb 16, 2019

@sergehuber
ContributorAuthor

Almost, I'm using the OSGi servlet right now, which seems to lack an extension point for that. Maybe I will need to contribute it if my understanding is correct ?

oliemansm

oliemansm commented on Feb 16, 2019

@oliemansm
Member

Right, I don't have any experience with OSGi unfortunately. There's a GraphQLSchemaProvider in the OsgiGraphQLHttpServlet that's responsible for providing the GraphQLSchema. Can't you use that somehow?

sergehuber

sergehuber commented on Feb 18, 2019

@sergehuber
ContributorAuthor

Actually that schemaProvider is initialized this way :

    this.schemaProvider = new DefaultGraphQLSchemaProvider(newSchema().query(queryTypeBuilder.build())
            .mutation(mutationType)
            .subscription(subscriptionType)
            .additionalTypes(types)
            .build());

so it's not pluggeable (yet) and can't hook a parser to generate it. I could provide a patch to do this but I need to get around to implementing and testing that.

changed the title [-]SDL support[/-] [+]SDL support for OSGi servlet[/+] on Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sergehuber@oliemansm

        Issue actions

          SDL support for OSGi servlet · Issue #143 · graphql-java-kickstart/graphql-java-servlet