-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Change gen usage #1115
Merged
Merged
Change gen usage #1115
Conversation
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
# Conflicts: # core/src/test/scala/caliban/execution/FieldArgsSpec.scala
# Conflicts: # build.sbt
# Conflicts: # examples/src/main/scala/example/federation/FederatedApi.scala
# Conflicts: # .circleci/config.yml # adapters/http4s/src/test/scala/caliban/Http4sAdapterSpec.scala # adapters/play/src/test/scala/caliban/PlayAdapterSpec.scala # examples/src/main/scala/example/federation/FederatedApi.scala # federation/src/main/scala/caliban/federation/Federation.scala
Fluxx
pushed a commit
to Fluxx/caliban
that referenced
this pull request
Jan 24, 2022
* Upgrade Scala 3 to 3.1.0 * Give federation a little help * Simplify * Remove weird trick * Update CI * Fix name * Simplify * Simplify * fmt * Simplify * Add R parameter to gen * fmt * Simplify * Cleanup * Fix examples * Cleanup * Prettify * Simplify * Fix federation * Scala 3 fix * Proper fix
Fluxx
pushed a commit
to Fluxx/caliban
that referenced
this pull request
Jan 27, 2022
* Upgrade Scala 3 to 3.1.0 * Give federation a little help * Simplify * Remove weird trick * Update CI * Fix name * Simplify * Simplify * fmt * Simplify * Add R parameter to gen * fmt * Simplify * Cleanup * Fix examples * Cleanup * Prettify * Simplify * Fix federation * Scala 3 fix * Proper fix
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
TL;DR
gen[A]
becomesgen[R, A]
For Scala 2:
You no longer need to worry about calling the right
gen
(fromSchema
vsGenericSchema
), you can simply useSchema.gen
everywhere. It now takes 2 type parametersR
andA
but you can usually omit them if you explicitly define the return type of your schema.If you use
genMacro
, you still need to do it onGenericSchema
.For Scala 3:
It is no longer necessary to use
GenericSchema[R]
. You can simply useSchema.gen
when you need to explicitly derive a schema. Caliban will be able to derive aSchema[R, A]
directly from that.If your
R
is notAny
, you need to pass it to thegraphQL
function, unless you already have aSchema[R, Query]
in scope:If you want to see the code generated by the derivation, you can use
Schema.genDebug
instead. It will print the generated code to the console when compiling.