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

feat: Allow overriding the executor used to GraphQLInterpreter #1135

Closed
wants to merge 7 commits into from
Closed

feat: Allow overriding the executor used to GraphQLInterpreter #1135

wants to merge 7 commits into from

Conversation

frekw
Copy link
Collaborator

@frekw frekw commented Nov 11, 2021

No description provided.

/**
* Verifies that the given schema is valid. Fails with a [[caliban.CalibanError.ValidationError]] otherwise.
*/
def validateSchema[R](schema: RootSchemaBuilder[R]): IO[ValidationError, RootSchema[R]]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can exclude this one if we want to.

@ghostdogpr
Copy link
Owner

While this is OK, I'm curious if you are able to implement what you needed with an ExecutionWrapper. If you are, I'd rather not add this until someone actually need it.

@frekw
Copy link
Collaborator Author

frekw commented Nov 11, 2021

I think I'll be able to, but haven't been able to test enough due to #1136. Will get back to you that asap tomorrow 😅

@frekw
Copy link
Collaborator Author

frekw commented Nov 12, 2021

@ghostdogpr it worked great!

I could basically do this

def apply[R](
    schema: __Schema
  ): GraphQL[R] = {
    val builder = RootSchemaBuilder(
      query = Some(Operation[R](schema.queryType, Step.NullStep)),
      mutation = schema.mutationType.map(mt => Operation[R](mt, Step.NullStep)),
      subscription = None
    )

    new GraphQL[R] {
      protected val additionalDirectives: List[__Directive]            = schema.directives
      protected val schemaBuilder: caliban.schema.RootSchemaBuilder[R] = builder
      protected val wrappers: List[caliban.wrappers.Wrapper[R]]        = List()
    }
  }

to get a schema without resolvers and then just wrap that up with an ExecutionWrapper! 👍 👏

@frekw frekw closed this Nov 12, 2021
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

Successfully merging this pull request may close these issues.

2 participants