Skip to content

Commit

Permalink
Scala 3 Support (#847)
Browse files Browse the repository at this point in the history
* Initial setup

* fmt

* Fix CI

* Move stuff

* Simplify

* Fix CI

* Upgrade Scala 3 to RC2

* gqldoc macro for Scala 3 (#849)

* Implement derivation for SubscriptionSchema

* Implement ArgBuilder derivation

* Polishing

* Schema derivation

* Remove test code

* WIP Schema

* Enable tests on Scala 3

* Uncomment some tests

* Remove logic for value classes since it's not supported

* Fix ExecutionSpec

* Fix ValidationSchemaSpec

* Enable client on Scala 3

* Remove federation from Scala 3

* Enable Scala 3 on Caliban Client for Scala.js

* Simplify derivation and make it work with Scala enums

* Exclude test for now

* Remove import

* cats-parse scala3 (#850)

* bak cat-parse

* merge scala3 branch

* update cats-parse

* Update core/src/main/scala-3/caliban/parsing/Parser.scala

* Update core/src/main/scala-3/caliban/parsing/Parser.scala

Co-authored-by: Pierre Ricadat <[email protected]>

* Enable tests

* Unignore last ignored test

* Fix merge issue

* Cosmetic changes

* fmt

* Update docs

Co-authored-by: Javier Martínez <[email protected]>
Co-authored-by: timzaak <[email protected]>
  • Loading branch information
3 people authored May 10, 2021
1 parent 2246821 commit 2938615
Show file tree
Hide file tree
Showing 68 changed files with 2,199 additions and 798 deletions.
21 changes: 21 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ jobs:
- "~/.ivy2/cache"
- "~/.sbt"
- "~/.m2"
test3_jdk11:
docker:
- image: circleci/openjdk:11-jdk-node
steps:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++3.0.0-RC3! core/test clientJVM/test clientJS/compile zioHttp/compile
- save_cache:
key: sbtcache
paths:
- "~/.ivy2/cache"
- "~/.sbt"
- "~/.m2"
test212_js:
docker:
- image: circleci/openjdk:8-jdk-node
Expand Down Expand Up @@ -120,12 +134,19 @@ workflows:
filters:
tags:
only: /^v[0-9]+(\.[0-9]+)*$/
- test3_jdk11:
requires:
- lint
filters:
tags:
only: /^v[0-9]+(\.[0-9]+)*$/
- release:
context: Sonatype
requires:
- test212_jdk8
- test213_jdk11
- test212_js
- test3_jdk11
filters:
branches:
only:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ object ZHttpAdapter {

type Subscriptions = Ref[Map[String, Promise[Any, Unit]]]

val contentTypeApplicationGraphQL = Header.custom(HttpHeaderNames.CONTENT_TYPE.toString(), "application/graphql")
private val contentTypeApplicationGraphQL: Header =
Header.custom(HttpHeaderNames.CONTENT_TYPE.toString(), "application/graphql")

def makeHttpService[R, E](
interpreter: GraphQLInterpreter[R, E],
Expand Down Expand Up @@ -62,7 +63,7 @@ object ZHttpAdapter {
enableIntrospection: Boolean = true,
keepAliveTime: Option[Duration] = None,
queryExecution: QueryExecution = QueryExecution.Parallel
) =
): HttpApp[R with Clock, E] =
HttpApp.responseM(
for {
ref <- Ref.make(Map.empty[String, Promise[Any, Unit]])
Expand Down Expand Up @@ -107,8 +108,7 @@ object ZHttpAdapter {
case None => connectionError
}
case GraphQLWSRequest("stop", id, _) =>
removeSubscription(id, subscriptions)
.flatMap(_ => ZStream.empty)
removeSubscription(id, subscriptions) *> ZStream.empty

})
.flatten
Expand Down Expand Up @@ -186,7 +186,7 @@ object ZHttpAdapter {
HttpError.BadRequest.apply(s"Invalid json: $error")
case ParsingFailure(message, _) =>
HttpError.BadRequest.apply(message)
case t: Throwable => HttpError.InternalServerError.apply("Internal Server Error", Some(t.getCause()))
case t: Throwable => HttpError.InternalServerError.apply("Internal Server Error", Some(t.getCause))
})
}

Expand All @@ -210,7 +210,7 @@ object ZHttpAdapter {
.obj(
"id" -> Json.fromString(id.getOrElse("")),
"type" -> Json.fromString("error"),
"message" -> Json.fromString(e.toString())
"message" -> Json.fromString(e.toString)
)
.toString()
)
Expand Down
Loading

0 comments on commit 2938615

Please sign in to comment.