-
-
Notifications
You must be signed in to change notification settings - Fork 250
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
Add unsafeRunServer method #2050
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would the user do a provide for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paulpdaniels Just to make sure I understood your question correctly, do you mean if they have a
GraphQL[R]
whereR
is notAny
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think we only have
provide
for the interpreter or for the resulting ZIO but on this case you can't specify a graphql wide environmentThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I'm wrong, but the way I see it is that if you're already propagating services via the ZIO environment, you're already familiar enough with the ZIO ecosystem to go for the normal
object Main extends ZIOAppDefault
way.I don't think we should see this method as a substitute for it, but rather as a way for users that either never used ZIO before or just wanna prototype something without without too much fluff get started quickly. Having said that, in case we do think it's good to give this option to users, we can do something along these lines:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree if they use zio environment, they shouldn't need this. For demo purposes I think using zio environment is complex enough to show a full zio solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if you just went one level up to use ZIOApp instead it has an apply method that accepts a bootstrap method too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could take the wait and see approach, Im just wondering about the progression that each step gets taught. If we include a way to provide the layer you can teach Layers as a progression instead of first having to teach, well now we need to use this main class syntax before we can do the thing we really want which is adding service dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried a couple of things, and ended up with introducing a
.unsafe
syntax method. That allows to do the following:gql.unsafe.provideLayer(???).runServer(...)
.In case we don't need to eliminate the environment, we can run it unsafely as
gql.unsafe.runServer(...)
@ghostdogpr @paulpdaniels are you OK with these changes?