From fd590459835ca593f7e6f4056f650294a0c249f6 Mon Sep 17 00:00:00 2001 From: "lucuma-steward[bot]" <106720676+lucuma-steward[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 16:16:59 +0000 Subject: [PATCH 1/6] Update sbt-scalafix, scalafix-core to 0.12.0 --- build.sbt | 2 +- project/plugins.sbt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index f1c0927c..5ca5b546 100644 --- a/build.sbt +++ b/build.sbt @@ -163,7 +163,7 @@ lazy val sbtPlugin = project moduleName := "sbt-clue", crossScalaVersions := List("2.12.19"), scalacOptions := Nil, - addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0"), addSbtPlugin("org.portable-scala" % "sbt-platform-deps" % "1.0.2"), addSbtPlugin("org.portable-scala" % "sbt-crossproject" % "1.3.2"), buildInfoPackage := "clue.sbt", diff --git a/project/plugins.sbt b/project/plugins.sbt index b5e74b92..3b95e9c5 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ addSbtPlugin("edu.gemini" % "sbt-lucuma-lib" % "0.11.13") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") From a436b8ff16a5b6a16a9a8fbf0c3ae0b7dc5988ce Mon Sep 17 00:00:00 2001 From: Hugo van Rijswijk Date: Mon, 18 Mar 2024 19:21:19 +0100 Subject: [PATCH 2/6] Update and run scalafix --- .scalafix-common.conf | 1 + .scalafmt-common.conf | 2 +- core/src/main/scala/clue/ErrorPolicy.scala | 2 +- core/src/main/scala/clue/FetchClientImpl.scala | 8 ++++---- core/src/main/scala/clue/backends.scala | 2 +- core/src/main/scala/clue/clients.scala | 6 +++--- core/src/main/scala/clue/package.scala | 2 +- .../main/scala/clue/websocket/ApolloClient.scala | 14 +++++++------- .../main/scala/clue/websocket/CloseParams.scala | 2 +- core/src/main/scala/clue/websocket/package.scala | 2 +- .../src/main/scala/clue/gen/Accumulator.scala | 2 +- .../src/main/scala/clue/gen/Generator.scala | 6 +++--- .../src/main/scala/clue/gen/GraphQLGen.scala | 6 +++--- .../main/scala/clue/gen/GraphQLGenConfig.scala | 2 +- gen/rules/src/main/scala/clue/gen/QueryGen.scala | 8 ++++---- .../src/main/scala/clue/gen/SchemaGen.scala | 2 +- .../src/main/scala/clue/gen/annotations.scala | 4 ++-- .../test/scala/clue/gen/AccumulatorSuite.scala | 6 +++--- .../src/main/scala/clue/http4sjdkDemo/Demo.scala | 8 ++++---- .../scala/clue/http4s/Http4sHttpBackend.scala | 10 +++++----- .../scala/clue/http4s/Http4sHttpClient.scala | 2 +- .../clue/http4s/Http4sWebSocketBackend.scala | 16 ++++++++-------- model/src/main/scala/clue/data/Input.scala | 8 ++++---- .../scala/clue/model/GraphQLDataResponse.scala | 2 +- .../src/main/scala/clue/model/GraphQLError.scala | 6 +++--- .../main/scala/clue/model/GraphQLRequest.scala | 2 +- .../main/scala/clue/model/StreamingMessage.scala | 2 +- .../src/main/scala/clue/model/json/package.scala | 6 +++--- model/src/test/scala/clue/data/InputSpec.scala | 16 ++++++++-------- .../src/test/scala/clue/data/arb/ArbInput.scala | 8 ++++---- .../scala/clue/model/GraphQLResponseSpec.scala | 2 +- .../scala/clue/model/arb/ArbFromClient.scala | 6 +++--- .../scala/clue/model/arb/ArbFromServer.scala | 6 +++--- .../clue/model/arb/ArbGraphQLDataResponse.scala | 8 ++++---- .../scala/clue/model/arb/ArbGraphQLError.scala | 6 +++--- .../scala/clue/model/arb/ArbGraphQLRequest.scala | 4 ++-- .../clue/model/arb/ArbGraphQLResponse.scala | 8 ++++---- .../src/test/scala/clue/model/arb/ArbJson.scala | 2 +- .../model/json/GraphQLDataResponseJsonSpec.scala | 2 +- .../clue/model/json/GraphQLErrorJsonSpec.scala | 4 ++-- .../clue/model/json/GraphQLRequestJsonSpec.scala | 4 ++-- .../model/json/StreamingMessageJsonSpec.scala | 4 ++-- project/plugins.sbt | 2 +- .../src/main/scala/clue/sbt/CluePlugin.scala | 10 +++++----- .../src/main/scala/clue/js/FetchJSBackend.scala | 12 ++++++------ .../main/scala/clue/js/WebSocketJSBackend.scala | 14 +++++++------- .../main/scala/clue/js/WebSocketJSClient.scala | 2 +- 47 files changed, 130 insertions(+), 129 deletions(-) diff --git a/.scalafix-common.conf b/.scalafix-common.conf index 5d349c36..e38e6ca4 100644 --- a/.scalafix-common.conf +++ b/.scalafix-common.conf @@ -7,3 +7,4 @@ rules = [ OrganizeImports ] +OrganizeImports.targetDialect = Auto diff --git a/.scalafmt-common.conf b/.scalafmt-common.conf index 85cebd19..0d8610d0 100644 --- a/.scalafmt-common.conf +++ b/.scalafmt-common.conf @@ -4,7 +4,7 @@ # this file by hand! Instead, if you wish to make changes, you should # make a PR to sbt-lucuma. -version = "3.7.17" +version = "3.8.0" style = default runner.dialect = scala3 diff --git a/core/src/main/scala/clue/ErrorPolicy.scala b/core/src/main/scala/clue/ErrorPolicy.scala index 696ad11d..46944c0e 100644 --- a/core/src/main/scala/clue/ErrorPolicy.scala +++ b/core/src/main/scala/clue/ErrorPolicy.scala @@ -6,7 +6,7 @@ package clue import cats.Applicative import cats.ApplicativeThrow import cats.data.Ior -import cats.syntax.all._ +import cats.syntax.all.* import clue.model.GraphQLDataResponse import clue.model.GraphQLErrors import clue.model.GraphQLResponse diff --git a/core/src/main/scala/clue/FetchClientImpl.scala b/core/src/main/scala/clue/FetchClientImpl.scala index 24c65c8a..2f161268 100644 --- a/core/src/main/scala/clue/FetchClientImpl.scala +++ b/core/src/main/scala/clue/FetchClientImpl.scala @@ -4,12 +4,12 @@ package clue import cats.MonadThrow -import cats.syntax.all._ +import cats.syntax.all.* import clue.model.GraphQLRequest import clue.model.GraphQLResponse -import clue.model.json._ -import io.circe._ -import io.circe.parser._ +import clue.model.json.* +import io.circe.* +import io.circe.parser.* import org.typelevel.log4cats.Logger // Response format from Spec: https://github.com/APIs-guru/graphql-over-http diff --git a/core/src/main/scala/clue/backends.scala b/core/src/main/scala/clue/backends.scala index eb7a5b4c..4ac5fb77 100644 --- a/core/src/main/scala/clue/backends.scala +++ b/core/src/main/scala/clue/backends.scala @@ -3,7 +3,7 @@ package clue -import cats.syntax.all._ +import cats.syntax.all.* import clue.model.GraphQLRequest import clue.model.StreamingMessage import io.circe.Encoder diff --git a/core/src/main/scala/clue/clients.scala b/core/src/main/scala/clue/clients.scala index 27df022b..cd6915c6 100644 --- a/core/src/main/scala/clue/clients.scala +++ b/core/src/main/scala/clue/clients.scala @@ -4,9 +4,9 @@ package clue import cats.effect.Resource -import cats.syntax.all._ -import io.circe._ -import io.circe.syntax._ +import cats.syntax.all.* +import io.circe.* +import io.circe.syntax.* /** * A client that allows one-shot queries and mutations. diff --git a/core/src/main/scala/clue/package.scala b/core/src/main/scala/clue/package.scala index 3067c027..df3f2ae2 100644 --- a/core/src/main/scala/clue/package.scala +++ b/core/src/main/scala/clue/package.scala @@ -5,7 +5,7 @@ import cats.Eq import cats.MonadError import cats.effect.Concurrent import cats.effect.Deferred -import cats.syntax.all._ +import cats.syntax.all.* import org.typelevel.log4cats.Logger package object clue { diff --git a/core/src/main/scala/clue/websocket/ApolloClient.scala b/core/src/main/scala/clue/websocket/ApolloClient.scala index 2822c386..95a12fca 100644 --- a/core/src/main/scala/clue/websocket/ApolloClient.scala +++ b/core/src/main/scala/clue/websocket/ApolloClient.scala @@ -3,23 +3,23 @@ package clue.websocket +import cats.effect.* import cats.effect.Ref import cats.effect.Temporal -import cats.effect._ -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.std.Queue import cats.effect.std.UUIDGen -import cats.syntax.all._ -import clue._ +import cats.syntax.all.* +import clue.* import clue.model.GraphQLErrors import clue.model.GraphQLRequest import clue.model.GraphQLResponse import clue.model.StreamingMessage -import clue.model.json._ +import clue.model.json.* import fs2.Stream import fs2.concurrent.SignallingRef -import io.circe._ -import io.circe.parser._ +import io.circe.* +import io.circe.parser.* import org.typelevel.log4cats.Logger import java.util.UUID diff --git a/core/src/main/scala/clue/websocket/CloseParams.scala b/core/src/main/scala/clue/websocket/CloseParams.scala index dec7ea45..33a9a53d 100644 --- a/core/src/main/scala/clue/websocket/CloseParams.scala +++ b/core/src/main/scala/clue/websocket/CloseParams.scala @@ -3,7 +3,7 @@ package clue.websocket -import cats.syntax.all._ +import cats.syntax.all.* case class CloseParams(code: Option[Int] = none, reason: Option[String] = none) object CloseParams { diff --git a/core/src/main/scala/clue/websocket/package.scala b/core/src/main/scala/clue/websocket/package.scala index 138fe766..0bebcd59 100644 --- a/core/src/main/scala/clue/websocket/package.scala +++ b/core/src/main/scala/clue/websocket/package.scala @@ -3,7 +3,7 @@ package clue -import cats.syntax.all._ +import cats.syntax.all.* import scala.concurrent.duration.FiniteDuration diff --git a/gen/rules/src/main/scala/clue/gen/Accumulator.scala b/gen/rules/src/main/scala/clue/gen/Accumulator.scala index 15cc9dab..7200ffcb 100644 --- a/gen/rules/src/main/scala/clue/gen/Accumulator.scala +++ b/gen/rules/src/main/scala/clue/gen/Accumulator.scala @@ -3,7 +3,7 @@ package clue.gen -import cats._ +import cats.* /** * Holds the aggregated `CaseClass`es, their `ClassParam`s and possible `Sum` info as we recurse the diff --git a/gen/rules/src/main/scala/clue/gen/Generator.scala b/gen/rules/src/main/scala/clue/gen/Generator.scala index e5fb366b..dc8b3300 100644 --- a/gen/rules/src/main/scala/clue/gen/Generator.scala +++ b/gen/rules/src/main/scala/clue/gen/Generator.scala @@ -4,13 +4,13 @@ package clue.gen // import scalafix.v1._ -import cats.syntax.all._ +import cats.syntax.all.* import edu.gemini.grackle import edu.gemini.grackle.ScalarType -import edu.gemini.grackle.{Type => GType} +import edu.gemini.grackle.Type as GType import java.util.regex.Pattern -import scala.meta._ +import scala.meta.* trait Generator { protected val TypeSelect = "__typename" diff --git a/gen/rules/src/main/scala/clue/gen/GraphQLGen.scala b/gen/rules/src/main/scala/clue/gen/GraphQLGen.scala index 08940f62..37110e39 100644 --- a/gen/rules/src/main/scala/clue/gen/GraphQLGen.scala +++ b/gen/rules/src/main/scala/clue/gen/GraphQLGen.scala @@ -5,12 +5,12 @@ package clue.gen import cats.effect.IO import cats.effect.unsafe.implicits.global -import cats.syntax.all._ +import cats.syntax.all.* import edu.gemini.grackle.QueryParser import metaconfig.Configured -import scalafix.v1._ +import scalafix.v1.* -import scala.meta._ +import scala.meta.* class GraphQLGen(config: GraphQLGenConfig) extends SemanticRule("GraphQLGen") diff --git a/gen/rules/src/main/scala/clue/gen/GraphQLGenConfig.scala b/gen/rules/src/main/scala/clue/gen/GraphQLGenConfig.scala index 23f816f2..cc6695bb 100644 --- a/gen/rules/src/main/scala/clue/gen/GraphQLGenConfig.scala +++ b/gen/rules/src/main/scala/clue/gen/GraphQLGenConfig.scala @@ -7,7 +7,7 @@ import cats.effect.Deferred import cats.effect.IO import cats.effect.Ref import cats.effect.kernel.Resource -import cats.syntax.all._ +import cats.syntax.all.* import edu.gemini.grackle.Schema import metaconfig.ConfDecoder import metaconfig.generic.Surface diff --git a/gen/rules/src/main/scala/clue/gen/QueryGen.scala b/gen/rules/src/main/scala/clue/gen/QueryGen.scala index 2bcd6dcd..ea15d9d4 100644 --- a/gen/rules/src/main/scala/clue/gen/QueryGen.scala +++ b/gen/rules/src/main/scala/clue/gen/QueryGen.scala @@ -5,11 +5,11 @@ package clue.gen import cats.data.State import cats.effect.unsafe.implicits.global -import cats.syntax.all._ -import edu.gemini.grackle.UntypedOperation._ -import edu.gemini.grackle.{Term => _, Type => GType, _} +import cats.syntax.all.* +import edu.gemini.grackle.UntypedOperation.* +import edu.gemini.grackle.{Term as _, Type as GType, *} -import scala.meta._ +import scala.meta.* trait QueryGen extends Generator { diff --git a/gen/rules/src/main/scala/clue/gen/SchemaGen.scala b/gen/rules/src/main/scala/clue/gen/SchemaGen.scala index 95d0f914..d557b269 100644 --- a/gen/rules/src/main/scala/clue/gen/SchemaGen.scala +++ b/gen/rules/src/main/scala/clue/gen/SchemaGen.scala @@ -7,7 +7,7 @@ import edu.gemini.grackle.EnumType import edu.gemini.grackle.InputObjectType import edu.gemini.grackle.Schema -import scala.meta._ +import scala.meta.* trait SchemaGen extends Generator { // Just make sure "object Scalars" exists. diff --git a/gen/rules/src/main/scala/clue/gen/annotations.scala b/gen/rules/src/main/scala/clue/gen/annotations.scala index 1e75b460..ae5b1850 100644 --- a/gen/rules/src/main/scala/clue/gen/annotations.scala +++ b/gen/rules/src/main/scala/clue/gen/annotations.scala @@ -3,9 +3,9 @@ package clue.gen -import scalafix.v1._ +import scalafix.v1.* -import scala.meta._ +import scala.meta.* // Adapted from simulacrum-scalafix class AnnotationPattern(fqcn: String) { diff --git a/gen/rules/src/test/scala/clue/gen/AccumulatorSuite.scala b/gen/rules/src/test/scala/clue/gen/AccumulatorSuite.scala index 12c4ddf6..7a7eb9e3 100644 --- a/gen/rules/src/test/scala/clue/gen/AccumulatorSuite.scala +++ b/gen/rules/src/test/scala/clue/gen/AccumulatorSuite.scala @@ -3,11 +3,11 @@ package clue.gen -import cats._ +import cats.* import cats.kernel.laws.discipline.MonoidTests -import munit._ +import munit.* import org.scalacheck.Arbitrary -import org.scalacheck.Arbitrary._ +import org.scalacheck.Arbitrary.* import org.scalacheck.Gen class AccumulatorSuite extends DisciplineSuite { diff --git a/http4s-jdk-demo/src/main/scala/clue/http4sjdkDemo/Demo.scala b/http4s-jdk-demo/src/main/scala/clue/http4sjdkDemo/Demo.scala index 49532813..7b4c76f6 100644 --- a/http4s-jdk-demo/src/main/scala/clue/http4sjdkDemo/Demo.scala +++ b/http4s-jdk-demo/src/main/scala/clue/http4sjdkDemo/Demo.scala @@ -9,7 +9,7 @@ import cats.effect.IO import cats.effect.IOApp import cats.effect.Resource import cats.effect.Sync -import cats.syntax.all._ +import cats.syntax.all.* import clue.ErrorPolicy import clue.FetchClient import clue.GraphQLOperation @@ -19,13 +19,13 @@ import clue.websocket.WebSocketClient import io.circe.Decoder import io.circe.Encoder import io.circe.Json -import io.circe.generic.semiauto._ -import org.http4s.implicits._ +import io.circe.generic.semiauto.* +import org.http4s.implicits.* import org.http4s.jdkhttpclient.JdkWSClient import org.typelevel.log4cats.Logger import org.typelevel.log4cats.slf4j.Slf4jLogger -import scala.concurrent.duration._ +import scala.concurrent.duration.* import scala.util.Random object Demo extends IOApp.Simple { diff --git a/http4s/src/main/scala/clue/http4s/Http4sHttpBackend.scala b/http4s/src/main/scala/clue/http4s/Http4sHttpBackend.scala index d322666b..9852bb8f 100644 --- a/http4s/src/main/scala/clue/http4s/Http4sHttpBackend.scala +++ b/http4s/src/main/scala/clue/http4s/Http4sHttpBackend.scala @@ -3,14 +3,14 @@ package clue.http4s -import cats.effect._ -import clue._ +import cats.effect.* +import clue.* import clue.model.GraphQLRequest -import clue.model.json._ +import clue.model.json.* import io.circe.Encoder -import io.circe.syntax._ +import io.circe.syntax.* import org.http4s.Request -import org.http4s.circe._ +import org.http4s.circe.* import org.http4s.client.Client import org.http4s.client.dsl.Http4sClientDsl diff --git a/http4s/src/main/scala/clue/http4s/Http4sHttpClient.scala b/http4s/src/main/scala/clue/http4s/Http4sHttpClient.scala index 7d73fbd8..f8e2e8bc 100644 --- a/http4s/src/main/scala/clue/http4s/Http4sHttpClient.scala +++ b/http4s/src/main/scala/clue/http4s/Http4sHttpClient.scala @@ -7,7 +7,7 @@ import cats.Applicative import cats.MonadThrow import clue.FetchClientImpl import org.http4s.Headers -import org.http4s.Method._ +import org.http4s.Method.* import org.http4s.Request import org.http4s.Uri import org.typelevel.log4cats.Logger diff --git a/http4s/src/main/scala/clue/http4s/Http4sWebSocketBackend.scala b/http4s/src/main/scala/clue/http4s/Http4sWebSocketBackend.scala index 81fdd6ac..d2964f22 100644 --- a/http4s/src/main/scala/clue/http4s/Http4sWebSocketBackend.scala +++ b/http4s/src/main/scala/clue/http4s/Http4sWebSocketBackend.scala @@ -3,18 +3,18 @@ package clue.http4s +import cats.effect.* import cats.effect.Resource.ExitCase -import cats.effect._ -import cats.effect.implicits._ -import cats.syntax.all._ -import clue._ +import cats.effect.implicits.* +import cats.syntax.all.* +import clue.* import clue.model.StreamingMessage -import clue.model.json._ -import clue.websocket._ -import io.circe.syntax._ +import clue.model.json.* +import clue.websocket.* +import io.circe.syntax.* import org.http4s.Headers import org.http4s.Uri -import org.http4s.client.websocket._ +import org.http4s.client.websocket.* /** * Streaming backend for http4s WebSocket client. diff --git a/model/src/main/scala/clue/data/Input.scala b/model/src/main/scala/clue/data/Input.scala index 1d70682b..923d2b06 100644 --- a/model/src/main/scala/clue/data/Input.scala +++ b/model/src/main/scala/clue/data/Input.scala @@ -12,10 +12,10 @@ import cats.Monad import cats.Show import cats.Traverse import cats.data.Ior -import cats.syntax.all._ -import clue.data.syntax._ -import io.circe._ -import io.circe.syntax._ +import cats.syntax.all.* +import clue.data.syntax.* +import io.circe.* +import io.circe.syntax.* import scala.annotation.tailrec diff --git a/model/src/main/scala/clue/model/GraphQLDataResponse.scala b/model/src/main/scala/clue/model/GraphQLDataResponse.scala index 10e7c376..7f1d408a 100644 --- a/model/src/main/scala/clue/model/GraphQLDataResponse.scala +++ b/model/src/main/scala/clue/model/GraphQLDataResponse.scala @@ -4,7 +4,7 @@ package clue.model import cats.Eq -import cats.syntax.option._ +import cats.syntax.option.* /** * A GraphQL response with data. diff --git a/model/src/main/scala/clue/model/GraphQLError.scala b/model/src/main/scala/clue/model/GraphQLError.scala index d477d906..0eb8b0ec 100644 --- a/model/src/main/scala/clue/model/GraphQLError.scala +++ b/model/src/main/scala/clue/model/GraphQLError.scala @@ -5,9 +5,9 @@ package clue.model import cats.Eq import cats.data.NonEmptyList -import cats.syntax.either._ -import cats.syntax.eq._ -import cats.syntax.option._ +import cats.syntax.either.* +import cats.syntax.eq.* +import cats.syntax.option.* import clue.model.GraphQLError.Location import clue.model.GraphQLError.PathElement diff --git a/model/src/main/scala/clue/model/GraphQLRequest.scala b/model/src/main/scala/clue/model/GraphQLRequest.scala index d828d5f9..fe9d38f8 100644 --- a/model/src/main/scala/clue/model/GraphQLRequest.scala +++ b/model/src/main/scala/clue/model/GraphQLRequest.scala @@ -4,7 +4,7 @@ package clue.model import cats.Eq -import cats.syntax.option._ +import cats.syntax.option.* // Request format from Spec: https://github.com/APIs-guru/graphql-over-http // { diff --git a/model/src/main/scala/clue/model/StreamingMessage.scala b/model/src/main/scala/clue/model/StreamingMessage.scala index 64cf4172..acd332d7 100644 --- a/model/src/main/scala/clue/model/StreamingMessage.scala +++ b/model/src/main/scala/clue/model/StreamingMessage.scala @@ -4,7 +4,7 @@ package clue.model import cats.Eq -import cats.syntax.all._ +import cats.syntax.all.* import io.circe.Json import io.circe.JsonObject diff --git a/model/src/main/scala/clue/model/json/package.scala b/model/src/main/scala/clue/model/json/package.scala index d4bc8301..949bdc53 100644 --- a/model/src/main/scala/clue/model/json/package.scala +++ b/model/src/main/scala/clue/model/json/package.scala @@ -5,9 +5,9 @@ package clue.model import cats.data.Ior import cats.data.NonEmptyList -import cats.syntax.all._ -import io.circe._ -import io.circe.syntax._ +import cats.syntax.all.* +import io.circe.* +import io.circe.syntax.* /** * JSON codecs for `clue.model`. diff --git a/model/src/test/scala/clue/data/InputSpec.scala b/model/src/test/scala/clue/data/InputSpec.scala index 7be24d1a..edb7d97d 100644 --- a/model/src/test/scala/clue/data/InputSpec.scala +++ b/model/src/test/scala/clue/data/InputSpec.scala @@ -5,21 +5,21 @@ package clue.data import cats.Eq import cats.kernel.laws.discipline.EqTests +import cats.laws.discipline.* import cats.laws.discipline.SemigroupalTests.Isomorphisms -import cats.laws.discipline._ -import cats.laws.discipline.arbitrary._ -import cats.syntax.all._ -import clue.data.syntax._ -import io.circe._ -import io.circe.generic.semiauto._ +import cats.laws.discipline.arbitrary.* +import cats.syntax.all.* +import clue.data.syntax.* +import io.circe.* +import io.circe.generic.semiauto.* import io.circe.testing.CodecTests -import io.circe.testing.instances._ +import io.circe.testing.instances.* import munit.DisciplineSuite import org.scalacheck.Arbitrary import org.scalacheck.Arbitrary.arbitrary import org.scalacheck.Prop.forAll -import arb.ArbInput._ +import arb.ArbInput.* case class SomeInput(value: Input[Int] = Ignore) object SomeInput { diff --git a/model/src/test/scala/clue/data/arb/ArbInput.scala b/model/src/test/scala/clue/data/arb/ArbInput.scala index 376061c2..ca08013a 100644 --- a/model/src/test/scala/clue/data/arb/ArbInput.scala +++ b/model/src/test/scala/clue/data/arb/ArbInput.scala @@ -3,11 +3,11 @@ package clue.data.arb -import clue.data._ -import org.scalacheck._ +import clue.data.* +import org.scalacheck.* -import Arbitrary._ -import Gen._ +import Arbitrary.* +import Gen.* trait ArbInput { implicit def arbInput[A: Arbitrary]: Arbitrary[Input[A]] = diff --git a/model/src/test/scala/clue/model/GraphQLResponseSpec.scala b/model/src/test/scala/clue/model/GraphQLResponseSpec.scala index 24b08d06..dd49c6a1 100644 --- a/model/src/test/scala/clue/model/GraphQLResponseSpec.scala +++ b/model/src/test/scala/clue/model/GraphQLResponseSpec.scala @@ -5,7 +5,7 @@ package clue.model import cats.laws.discipline.TraverseTests import clue.ListLimitingDisciplineSuite -import clue.model.arb._ +import clue.model.arb.* final class GraphQLResponseSpec extends ListLimitingDisciplineSuite { import ArbGraphQLResponse._ diff --git a/model/src/test/scala/clue/model/arb/ArbFromClient.scala b/model/src/test/scala/clue/model/arb/ArbFromClient.scala index 29502623..400c9022 100644 --- a/model/src/test/scala/clue/model/arb/ArbFromClient.scala +++ b/model/src/test/scala/clue/model/arb/ArbFromClient.scala @@ -5,12 +5,12 @@ package clue.model.arb import clue.model.GraphQLRequest import clue.model.StreamingMessage.FromClient -import clue.model.StreamingMessage.FromClient._ +import clue.model.StreamingMessage.FromClient.* import io.circe.Json import io.circe.JsonObject -import io.circe.testing.instances._ +import io.circe.testing.instances.* import org.scalacheck.Arbitrary -import org.scalacheck.Arbitrary._ +import org.scalacheck.Arbitrary.* import org.scalacheck.Gen trait ArbFromClient { diff --git a/model/src/test/scala/clue/model/arb/ArbFromServer.scala b/model/src/test/scala/clue/model/arb/ArbFromServer.scala index 9c9db093..80778217 100644 --- a/model/src/test/scala/clue/model/arb/ArbFromServer.scala +++ b/model/src/test/scala/clue/model/arb/ArbFromServer.scala @@ -8,11 +8,11 @@ import clue.model.GraphQLError import clue.model.GraphQLExtensions import clue.model.GraphQLResponse import clue.model.StreamingMessage.FromServer -import clue.model.StreamingMessage.FromServer._ +import clue.model.StreamingMessage.FromServer.* import io.circe.Json -import io.circe.testing.instances._ +import io.circe.testing.instances.* import org.scalacheck.Arbitrary -import org.scalacheck.Arbitrary._ +import org.scalacheck.Arbitrary.* import org.scalacheck.Gen trait ArbFromServer { diff --git a/model/src/test/scala/clue/model/arb/ArbGraphQLDataResponse.scala b/model/src/test/scala/clue/model/arb/ArbGraphQLDataResponse.scala index ae593417..47f91550 100644 --- a/model/src/test/scala/clue/model/arb/ArbGraphQLDataResponse.scala +++ b/model/src/test/scala/clue/model/arb/ArbGraphQLDataResponse.scala @@ -7,10 +7,10 @@ import cats.data.NonEmptyList import clue.model.GraphQLDataResponse import clue.model.GraphQLError import clue.model.GraphQLExtensions -import clue.model.arb.ArbGraphQLError._ -import io.circe.testing.instances._ -import org.scalacheck.Arbitrary._ -import org.scalacheck._ +import clue.model.arb.ArbGraphQLError.* +import io.circe.testing.instances.* +import org.scalacheck.* +import org.scalacheck.Arbitrary.* trait ArbGraphQLDataResponse { diff --git a/model/src/test/scala/clue/model/arb/ArbGraphQLError.scala b/model/src/test/scala/clue/model/arb/ArbGraphQLError.scala index 7f632f5f..242c8896 100644 --- a/model/src/test/scala/clue/model/arb/ArbGraphQLError.scala +++ b/model/src/test/scala/clue/model/arb/ArbGraphQLError.scala @@ -6,9 +6,9 @@ package arb import cats.data.NonEmptyList import clue.model.GraphQLErrors -import io.circe.testing.instances._ -import org.scalacheck.Arbitrary._ -import org.scalacheck._ +import io.circe.testing.instances.* +import org.scalacheck.* +import org.scalacheck.Arbitrary.* trait ArbGraphQLError { diff --git a/model/src/test/scala/clue/model/arb/ArbGraphQLRequest.scala b/model/src/test/scala/clue/model/arb/ArbGraphQLRequest.scala index ff36683c..595e9683 100644 --- a/model/src/test/scala/clue/model/arb/ArbGraphQLRequest.scala +++ b/model/src/test/scala/clue/model/arb/ArbGraphQLRequest.scala @@ -4,8 +4,8 @@ package clue.model.arb import clue.model.GraphQLRequest -import org.scalacheck.Arbitrary._ -import org.scalacheck._ +import org.scalacheck.* +import org.scalacheck.Arbitrary.* trait ArbGraphQLRequest { diff --git a/model/src/test/scala/clue/model/arb/ArbGraphQLResponse.scala b/model/src/test/scala/clue/model/arb/ArbGraphQLResponse.scala index 7f4c6bdc..2382aec2 100644 --- a/model/src/test/scala/clue/model/arb/ArbGraphQLResponse.scala +++ b/model/src/test/scala/clue/model/arb/ArbGraphQLResponse.scala @@ -7,10 +7,10 @@ import cats.data.Ior import clue.model.GraphQLErrors import clue.model.GraphQLExtensions import clue.model.GraphQLResponse -import clue.model.arb.ArbGraphQLError._ -import io.circe.testing.instances._ -import org.scalacheck.Arbitrary._ -import org.scalacheck._ +import clue.model.arb.ArbGraphQLError.* +import io.circe.testing.instances.* +import org.scalacheck.* +import org.scalacheck.Arbitrary.* trait ArbGraphQLResponse { diff --git a/model/src/test/scala/clue/model/arb/ArbJson.scala b/model/src/test/scala/clue/model/arb/ArbJson.scala index a6647528..bb5c6bb7 100644 --- a/model/src/test/scala/clue/model/arb/ArbJson.scala +++ b/model/src/test/scala/clue/model/arb/ArbJson.scala @@ -5,7 +5,7 @@ package clue.model.arb import io.circe.Json import org.scalacheck.Arbitrary -import org.scalacheck.Arbitrary._ +import org.scalacheck.Arbitrary.* import org.scalacheck.Gen trait ArbJson { diff --git a/model/src/test/scala/clue/model/json/GraphQLDataResponseJsonSpec.scala b/model/src/test/scala/clue/model/json/GraphQLDataResponseJsonSpec.scala index 0deae29c..ae94117f 100644 --- a/model/src/test/scala/clue/model/json/GraphQLDataResponseJsonSpec.scala +++ b/model/src/test/scala/clue/model/json/GraphQLDataResponseJsonSpec.scala @@ -8,7 +8,7 @@ import clue.model.GraphQLDataResponse import clue.model.arb.ArbGraphQLDataResponse import io.circe.Json import io.circe.testing.CodecTests -import io.circe.testing.instances._ +import io.circe.testing.instances.* final class GraphQLDataResponseJsonSpec extends ListLimitingDisciplineSuite { import ArbGraphQLDataResponse._ diff --git a/model/src/test/scala/clue/model/json/GraphQLErrorJsonSpec.scala b/model/src/test/scala/clue/model/json/GraphQLErrorJsonSpec.scala index 53d7f3e2..6be1beea 100644 --- a/model/src/test/scala/clue/model/json/GraphQLErrorJsonSpec.scala +++ b/model/src/test/scala/clue/model/json/GraphQLErrorJsonSpec.scala @@ -6,9 +6,9 @@ package clue.model.json import clue.ListLimitingDisciplineSuite import clue.model.GraphQLError import clue.model.GraphQLErrors -import clue.model.arb._ +import clue.model.arb.* import io.circe.testing.CodecTests -import io.circe.testing.instances._ +import io.circe.testing.instances.* final class GraphQLErrorJsonSpec extends ListLimitingDisciplineSuite { import ArbGraphQLError._ diff --git a/model/src/test/scala/clue/model/json/GraphQLRequestJsonSpec.scala b/model/src/test/scala/clue/model/json/GraphQLRequestJsonSpec.scala index af51a11a..632af7f3 100644 --- a/model/src/test/scala/clue/model/json/GraphQLRequestJsonSpec.scala +++ b/model/src/test/scala/clue/model/json/GraphQLRequestJsonSpec.scala @@ -5,10 +5,10 @@ package clue.model.json import clue.ListLimitingDisciplineSuite import clue.model.GraphQLRequest -import clue.model.arb._ +import clue.model.arb.* import io.circe.JsonObject import io.circe.testing.CodecTests -import io.circe.testing.instances._ +import io.circe.testing.instances.* final class GraphQLRequestJsonSpec extends ListLimitingDisciplineSuite { import ArbGraphQLRequest._ diff --git a/model/src/test/scala/clue/model/json/StreamingMessageJsonSpec.scala b/model/src/test/scala/clue/model/json/StreamingMessageJsonSpec.scala index 7e5f0906..865c3be5 100644 --- a/model/src/test/scala/clue/model/json/StreamingMessageJsonSpec.scala +++ b/model/src/test/scala/clue/model/json/StreamingMessageJsonSpec.scala @@ -6,9 +6,9 @@ package clue.model.json import clue.ListLimitingDisciplineSuite import clue.model.StreamingMessage.FromClient import clue.model.StreamingMessage.FromServer -import clue.model.arb._ +import clue.model.arb.* import io.circe.testing.CodecTests -import io.circe.testing.instances._ +import io.circe.testing.instances.* final class StreamingMessageJsonSpec extends ListLimitingDisciplineSuite { diff --git a/project/plugins.sbt b/project/plugins.sbt index 3b95e9c5..a0919ac0 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ -addSbtPlugin("edu.gemini" % "sbt-lucuma-lib" % "0.11.13") +addSbtPlugin("edu.gemini" % "sbt-lucuma-lib" % "0.11.15") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") diff --git a/sbt-plugin/src/main/scala/clue/sbt/CluePlugin.scala b/sbt-plugin/src/main/scala/clue/sbt/CluePlugin.scala index 5dbd8c90..3b162682 100644 --- a/sbt-plugin/src/main/scala/clue/sbt/CluePlugin.scala +++ b/sbt-plugin/src/main/scala/clue/sbt/CluePlugin.scala @@ -3,14 +3,14 @@ package clue.sbt -import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._ -import sbt._ +import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport.* +import sbt.* import sbtcrossproject.CrossPlugin import scalafix.sbt.ScalafixPlugin -import Keys._ -import CrossPlugin.autoImport._ -import ScalafixPlugin.autoImport._ +import Keys.* +import CrossPlugin.autoImport.* +import ScalafixPlugin.autoImport.* object CluePlugin extends AutoPlugin { diff --git a/scalajs/src/main/scala/clue/js/FetchJSBackend.scala b/scalajs/src/main/scala/clue/js/FetchJSBackend.scala index c5398f56..f6195056 100644 --- a/scalajs/src/main/scala/clue/js/FetchJSBackend.scala +++ b/scalajs/src/main/scala/clue/js/FetchJSBackend.scala @@ -4,19 +4,19 @@ package clue.js import cats.Applicative -import cats.effect._ -import cats.syntax.all._ -import clue._ +import cats.effect.* +import cats.syntax.all.* +import clue.* import clue.model.GraphQLRequest -import clue.model.json._ +import clue.model.json.* import io.circe.Encoder -import io.circe.syntax._ +import io.circe.syntax.* import org.scalajs.dom.AbortController import org.scalajs.dom.Fetch import org.scalajs.dom.Headers import org.scalajs.dom.HttpMethod import org.scalajs.dom.RequestInit -import org.scalajs.macrotaskexecutor.MacrotaskExecutor.Implicits._ +import org.scalajs.macrotaskexecutor.MacrotaskExecutor.Implicits.* import scala.scalajs.js.URIUtils import scala.util.Failure diff --git a/scalajs/src/main/scala/clue/js/WebSocketJSBackend.scala b/scalajs/src/main/scala/clue/js/WebSocketJSBackend.scala index eece9dcc..6a052428 100644 --- a/scalajs/src/main/scala/clue/js/WebSocketJSBackend.scala +++ b/scalajs/src/main/scala/clue/js/WebSocketJSBackend.scala @@ -4,16 +4,16 @@ package clue.js import cats.Applicative +import cats.effect.* import cats.effect.Ref -import cats.effect._ -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.std.Dispatcher -import cats.syntax.all._ -import clue._ +import cats.syntax.all.* +import clue.* import clue.model.StreamingMessage -import clue.model.json._ -import clue.websocket._ -import io.circe.syntax._ +import clue.model.json.* +import clue.websocket.* +import io.circe.syntax.* import org.scalajs.dom.CloseEvent import org.scalajs.dom.Event import org.scalajs.dom.MessageEvent diff --git a/scalajs/src/main/scala/clue/js/WebSocketJSClient.scala b/scalajs/src/main/scala/clue/js/WebSocketJSClient.scala index 1705e25a..711a8026 100644 --- a/scalajs/src/main/scala/clue/js/WebSocketJSClient.scala +++ b/scalajs/src/main/scala/clue/js/WebSocketJSClient.scala @@ -4,7 +4,7 @@ package clue.js import cats.effect.Async -import clue.websocket._ +import clue.websocket.* import org.typelevel.log4cats.Logger object WebSocketJSClient { From 5275accc73562b710678fd79770d5ea79dcf4818 Mon Sep 17 00:00:00 2001 From: Hugo van Rijswijk Date: Mon, 18 Mar 2024 20:13:41 +0100 Subject: [PATCH 3/6] Formatting --- gen/rules/src/main/scala/clue/gen/Generator.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gen/rules/src/main/scala/clue/gen/Generator.scala b/gen/rules/src/main/scala/clue/gen/Generator.scala index dc8b3300..198a57fa 100644 --- a/gen/rules/src/main/scala/clue/gen/Generator.scala +++ b/gen/rules/src/main/scala/clue/gen/Generator.scala @@ -183,6 +183,7 @@ trait Generator { (parentBody, false) case Define(newParentBody, early, inits) => val allInits = inits ++ extending.map(t => init"${Type.Name(t)}()") + (newParentBody :+ // q"case class ${Type.Name(name)}(..$pars) extends ..$earlyDefs with ..$allParents", q"case class ${Type.Name(name)}(..$pars) extends {..$early} with ..$allInits", @@ -282,6 +283,7 @@ trait Generator { (parentBody, false) case Define(newParentBody, early, inits) => val allInits = inits ++ extending.map(t => init"${Type.Name(t)}()") + (newParentBody :+ q"sealed trait ${Type.Name(name)} extends { ..$early } with ..$allInits { ..${pars.map(paramToVal)} }", true From b868ab4a48377e0c4e38d6b4ebfd27213fa3148e Mon Sep 17 00:00:00 2001 From: Hugo van Rijswijk Date: Mon, 18 Mar 2024 20:28:42 +0100 Subject: [PATCH 4/6] Update gen output tests --- .../src/main/scala/test/LucumaODBSchema.scala | 168 +++++++++--------- .../src/main/scala/test/StarWarsSchema.scala | 4 +- 2 files changed, 86 insertions(+), 86 deletions(-) diff --git a/gen/output/src/main/scala/test/LucumaODBSchema.scala b/gen/output/src/main/scala/test/LucumaODBSchema.scala index 8c18bd77..7c2c2946 100644 --- a/gen/output/src/main/scala/test/LucumaODBSchema.scala +++ b/gen/output/src/main/scala/test/LucumaODBSchema.scala @@ -31,10 +31,10 @@ object LucumaODB { case object Disabled extends Breakpoint() implicit val eqBreakpoint: cats.Eq[Breakpoint] = cats.Eq.fromUniversalEquals implicit val showBreakpoint: cats.Show[Breakpoint] = cats.Show.fromToString - implicit val jsonEncoderBreakpoint: io.circe.Encoder[Breakpoint] = io.circe.Encoder.encodeString.contramap[Breakpoint]({ + implicit val jsonEncoderBreakpoint: io.circe.Encoder[Breakpoint] = io.circe.Encoder.encodeString.contramap[Breakpoint] { case Enabled => "ENABLED" case Disabled => "DISABLED" - }) + } implicit val jsonDecoderBreakpoint: io.circe.Decoder[Breakpoint] = io.circe.Decoder.decodeString.emap(_ match { case "ENABLED" => Right(Enabled) @@ -51,11 +51,11 @@ object LucumaODB { case object Gaia extends CatalogName() implicit val eqCatalogName: cats.Eq[CatalogName] = cats.Eq.fromUniversalEquals implicit val showCatalogName: cats.Show[CatalogName] = cats.Show.fromToString - implicit val jsonEncoderCatalogName: io.circe.Encoder[CatalogName] = io.circe.Encoder.encodeString.contramap[CatalogName]({ + implicit val jsonEncoderCatalogName: io.circe.Encoder[CatalogName] = io.circe.Encoder.encodeString.contramap[CatalogName] { case Simbad => "SIMBAD" case Horizon => "HORIZON" case Gaia => "GAIA" - }) + } implicit val jsonDecoderCatalogName: io.circe.Decoder[CatalogName] = io.circe.Decoder.decodeString.emap(_ match { case "SIMBAD" => Right(Simbad) @@ -78,7 +78,7 @@ object LucumaODB { case object ThreePointZero extends CloudExtinction() implicit val eqCloudExtinction: cats.Eq[CloudExtinction] = cats.Eq.fromUniversalEquals implicit val showCloudExtinction: cats.Show[CloudExtinction] = cats.Show.fromToString - implicit val jsonEncoderCloudExtinction: io.circe.Encoder[CloudExtinction] = io.circe.Encoder.encodeString.contramap[CloudExtinction]({ + implicit val jsonEncoderCloudExtinction: io.circe.Encoder[CloudExtinction] = io.circe.Encoder.encodeString.contramap[CloudExtinction] { case PointOne => "POINT_ONE" case PointThree => "POINT_THREE" case PointFive => "POINT_FIVE" @@ -86,7 +86,7 @@ object LucumaODB { case OnePointFive => "ONE_POINT_FIVE" case TwoPointZero => "TWO_POINT_ZERO" case ThreePointZero => "THREE_POINT_ZERO" - }) + } implicit val jsonDecoderCloudExtinction: io.circe.Decoder[CloudExtinction] = io.circe.Decoder.decodeString.emap(_ match { case "POINT_ONE" => Right(PointOne) @@ -112,10 +112,10 @@ object LucumaODB { case object Degrees extends DeclinationUnits() implicit val eqDeclinationUnits: cats.Eq[DeclinationUnits] = cats.Eq.fromUniversalEquals implicit val showDeclinationUnits: cats.Show[DeclinationUnits] = cats.Show.fromToString - implicit val jsonEncoderDeclinationUnits: io.circe.Encoder[DeclinationUnits] = io.circe.Encoder.encodeString.contramap[DeclinationUnits]({ + implicit val jsonEncoderDeclinationUnits: io.circe.Encoder[DeclinationUnits] = io.circe.Encoder.encodeString.contramap[DeclinationUnits] { case Microarcseconds => "MICROARCSECONDS" case Degrees => "DEGREES" - }) + } implicit val jsonDecoderDeclinationUnits: io.circe.Decoder[DeclinationUnits] = io.circe.Decoder.decodeString.emap(_ match { case "MICROARCSECONDS" => Right(Microarcseconds) @@ -131,10 +131,10 @@ object LucumaODB { case object Updated extends EditType() implicit val eqEditType: cats.Eq[EditType] = cats.Eq.fromUniversalEquals implicit val showEditType: cats.Show[EditType] = cats.Show.fromToString - implicit val jsonEncoderEditType: io.circe.Encoder[EditType] = io.circe.Encoder.encodeString.contramap[EditType]({ + implicit val jsonEncoderEditType: io.circe.Encoder[EditType] = io.circe.Encoder.encodeString.contramap[EditType] { case Created => "CREATED" case Updated => "UPDATED" - }) + } implicit val jsonDecoderEditType: io.circe.Decoder[EditType] = io.circe.Decoder.decodeString.emap(_ match { case "CREATED" => Right(Created) @@ -153,13 +153,13 @@ object LucumaODB { case object UserSupplied extends EphemerisKeyType() implicit val eqEphemerisKeyType: cats.Eq[EphemerisKeyType] = cats.Eq.fromUniversalEquals implicit val showEphemerisKeyType: cats.Show[EphemerisKeyType] = cats.Show.fromToString - implicit val jsonEncoderEphemerisKeyType: io.circe.Encoder[EphemerisKeyType] = io.circe.Encoder.encodeString.contramap[EphemerisKeyType]({ + implicit val jsonEncoderEphemerisKeyType: io.circe.Encoder[EphemerisKeyType] = io.circe.Encoder.encodeString.contramap[EphemerisKeyType] { case Comet => "COMET" case AsteroidNew => "ASTEROID_NEW" case AsteroidOld => "ASTEROID_OLD" case MajorBody => "MAJOR_BODY" case UserSupplied => "USER_SUPPLIED" - }) + } implicit val jsonDecoderEphemerisKeyType: io.circe.Decoder[EphemerisKeyType] = io.circe.Decoder.decodeString.emap(_ match { case "COMET" => Right(Comet) @@ -181,10 +181,10 @@ object LucumaODB { case object Deleted extends Existence() implicit val eqExistence: cats.Eq[Existence] = cats.Eq.fromUniversalEquals implicit val showExistence: cats.Show[Existence] = cats.Show.fromToString - implicit val jsonEncoderExistence: io.circe.Encoder[Existence] = io.circe.Encoder.encodeString.contramap[Existence]({ + implicit val jsonEncoderExistence: io.circe.Encoder[Existence] = io.circe.Encoder.encodeString.contramap[Existence] { case Present => "PRESENT" case Deleted => "DELETED" - }) + } implicit val jsonDecoderExistence: io.circe.Decoder[Existence] = io.circe.Decoder.decodeString.emap(_ match { case "PRESENT" => Right(Present) @@ -202,12 +202,12 @@ object LucumaODB { case object XeArc extends GcalArc() implicit val eqGcalArc: cats.Eq[GcalArc] = cats.Eq.fromUniversalEquals implicit val showGcalArc: cats.Show[GcalArc] = cats.Show.fromToString - implicit val jsonEncoderGcalArc: io.circe.Encoder[GcalArc] = io.circe.Encoder.encodeString.contramap[GcalArc]({ + implicit val jsonEncoderGcalArc: io.circe.Encoder[GcalArc] = io.circe.Encoder.encodeString.contramap[GcalArc] { case ArArc => "AR_ARC" case ThArArc => "TH_AR_ARC" case CuArArc => "CU_AR_ARC" case XeArc => "XE_ARC" - }) + } implicit val jsonDecoderGcalArc: io.circe.Decoder[GcalArc] = io.circe.Decoder.decodeString.emap(_ match { case "AR_ARC" => Right(ArArc) @@ -228,11 +228,11 @@ object LucumaODB { case object QuartzHalogen extends GcalContinuum() implicit val eqGcalContinuum: cats.Eq[GcalContinuum] = cats.Eq.fromUniversalEquals implicit val showGcalContinuum: cats.Show[GcalContinuum] = cats.Show.fromToString - implicit val jsonEncoderGcalContinuum: io.circe.Encoder[GcalContinuum] = io.circe.Encoder.encodeString.contramap[GcalContinuum]({ + implicit val jsonEncoderGcalContinuum: io.circe.Encoder[GcalContinuum] = io.circe.Encoder.encodeString.contramap[GcalContinuum] { case IrGreyBodyLow => "IR_GREY_BODY_LOW" case IrGreyBodyHigh => "IR_GREY_BODY_HIGH" case QuartzHalogen => "QUARTZ_HALOGEN" - }) + } implicit val jsonDecoderGcalContinuum: io.circe.Decoder[GcalContinuum] = io.circe.Decoder.decodeString.emap(_ match { case "IR_GREY_BODY_LOW" => Right(IrGreyBodyLow) @@ -250,10 +250,10 @@ object LucumaODB { case object Visible extends GcalDiffuser() implicit val eqGcalDiffuser: cats.Eq[GcalDiffuser] = cats.Eq.fromUniversalEquals implicit val showGcalDiffuser: cats.Show[GcalDiffuser] = cats.Show.fromToString - implicit val jsonEncoderGcalDiffuser: io.circe.Encoder[GcalDiffuser] = io.circe.Encoder.encodeString.contramap[GcalDiffuser]({ + implicit val jsonEncoderGcalDiffuser: io.circe.Encoder[GcalDiffuser] = io.circe.Encoder.encodeString.contramap[GcalDiffuser] { case Ir => "IR" case Visible => "VISIBLE" - }) + } implicit val jsonDecoderGcalDiffuser: io.circe.Decoder[GcalDiffuser] = io.circe.Decoder.decodeString.emap(_ match { case "IR" => Right(Ir) @@ -278,7 +278,7 @@ object LucumaODB { case object Nd50 extends GcalFilter() implicit val eqGcalFilter: cats.Eq[GcalFilter] = cats.Eq.fromUniversalEquals implicit val showGcalFilter: cats.Show[GcalFilter] = cats.Show.fromToString - implicit val jsonEncoderGcalFilter: io.circe.Encoder[GcalFilter] = io.circe.Encoder.encodeString.contramap[GcalFilter]({ + implicit val jsonEncoderGcalFilter: io.circe.Encoder[GcalFilter] = io.circe.Encoder.encodeString.contramap[GcalFilter] { case None => "NONE" case Gmos => "GMOS" case Hros => "HROS" @@ -290,7 +290,7 @@ object LucumaODB { case Nd40 => "ND40" case Nd45 => "ND45" case Nd50 => "ND50" - }) + } implicit val jsonDecoderGcalFilter: io.circe.Decoder[GcalFilter] = io.circe.Decoder.decodeString.emap(_ match { case "NONE" => Right(None) @@ -324,10 +324,10 @@ object LucumaODB { case object Closed extends GcalShutter() implicit val eqGcalShutter: cats.Eq[GcalShutter] = cats.Eq.fromUniversalEquals implicit val showGcalShutter: cats.Show[GcalShutter] = cats.Show.fromToString - implicit val jsonEncoderGcalShutter: io.circe.Encoder[GcalShutter] = io.circe.Encoder.encodeString.contramap[GcalShutter]({ + implicit val jsonEncoderGcalShutter: io.circe.Encoder[GcalShutter] = io.circe.Encoder.encodeString.contramap[GcalShutter] { case Open => "OPEN" case Closed => "CLOSED" - }) + } implicit val jsonDecoderGcalShutter: io.circe.Decoder[GcalShutter] = io.circe.Decoder.decodeString.emap(_ match { case "OPEN" => Right(Open) @@ -344,11 +344,11 @@ object LucumaODB { case object Twelve extends GmosAmpCount() implicit val eqGmosAmpCount: cats.Eq[GmosAmpCount] = cats.Eq.fromUniversalEquals implicit val showGmosAmpCount: cats.Show[GmosAmpCount] = cats.Show.fromToString - implicit val jsonEncoderGmosAmpCount: io.circe.Encoder[GmosAmpCount] = io.circe.Encoder.encodeString.contramap[GmosAmpCount]({ + implicit val jsonEncoderGmosAmpCount: io.circe.Encoder[GmosAmpCount] = io.circe.Encoder.encodeString.contramap[GmosAmpCount] { case Three => "THREE" case Six => "SIX" case Twelve => "TWELVE" - }) + } implicit val jsonDecoderGmosAmpCount: io.circe.Decoder[GmosAmpCount] = io.circe.Decoder.decodeString.emap(_ match { case "THREE" => Right(Three) @@ -366,10 +366,10 @@ object LucumaODB { case object Fast extends GmosAmpReadMode() implicit val eqGmosAmpReadMode: cats.Eq[GmosAmpReadMode] = cats.Eq.fromUniversalEquals implicit val showGmosAmpReadMode: cats.Show[GmosAmpReadMode] = cats.Show.fromToString - implicit val jsonEncoderGmosAmpReadMode: io.circe.Encoder[GmosAmpReadMode] = io.circe.Encoder.encodeString.contramap[GmosAmpReadMode]({ + implicit val jsonEncoderGmosAmpReadMode: io.circe.Encoder[GmosAmpReadMode] = io.circe.Encoder.encodeString.contramap[GmosAmpReadMode] { case Slow => "SLOW" case Fast => "FAST" - }) + } implicit val jsonDecoderGmosAmpReadMode: io.circe.Decoder[GmosAmpReadMode] = io.circe.Decoder.decodeString.emap(_ match { case "SLOW" => Right(Slow) @@ -390,7 +390,7 @@ object LucumaODB { case object CustomWidth500 extends GmosCustomSlitWidth() implicit val eqGmosCustomSlitWidth: cats.Eq[GmosCustomSlitWidth] = cats.Eq.fromUniversalEquals implicit val showGmosCustomSlitWidth: cats.Show[GmosCustomSlitWidth] = cats.Show.fromToString - implicit val jsonEncoderGmosCustomSlitWidth: io.circe.Encoder[GmosCustomSlitWidth] = io.circe.Encoder.encodeString.contramap[GmosCustomSlitWidth]({ + implicit val jsonEncoderGmosCustomSlitWidth: io.circe.Encoder[GmosCustomSlitWidth] = io.circe.Encoder.encodeString.contramap[GmosCustomSlitWidth] { case CustomWidth025 => "CUSTOM_WIDTH_0_25" case CustomWidth050 => "CUSTOM_WIDTH_0_50" case CustomWidth075 => "CUSTOM_WIDTH_0_75" @@ -398,7 +398,7 @@ object LucumaODB { case CustomWidth150 => "CUSTOM_WIDTH_1_50" case CustomWidth200 => "CUSTOM_WIDTH_2_00" case CustomWidth500 => "CUSTOM_WIDTH_5_00" - }) + } implicit val jsonDecoderGmosCustomSlitWidth: io.circe.Decoder[GmosCustomSlitWidth] = io.circe.Decoder.decodeString.emap(_ match { case "CUSTOM_WIDTH_0_25" => Right(CustomWidth025) @@ -424,10 +424,10 @@ object LucumaODB { case object Hamamatsu extends GmosDetector() implicit val eqGmosDetector: cats.Eq[GmosDetector] = cats.Eq.fromUniversalEquals implicit val showGmosDetector: cats.Show[GmosDetector] = cats.Show.fromToString - implicit val jsonEncoderGmosDetector: io.circe.Encoder[GmosDetector] = io.circe.Encoder.encodeString.contramap[GmosDetector]({ + implicit val jsonEncoderGmosDetector: io.circe.Encoder[GmosDetector] = io.circe.Encoder.encodeString.contramap[GmosDetector] { case E2V => "E2_V" case Hamamatsu => "HAMAMATSU" - }) + } implicit val jsonDecoderGmosDetector: io.circe.Decoder[GmosDetector] = io.circe.Decoder.decodeString.emap(_ match { case "E2_V" => Right(E2V) @@ -444,11 +444,11 @@ object LucumaODB { case object Two extends GmosDisperserOrder() implicit val eqGmosDisperserOrder: cats.Eq[GmosDisperserOrder] = cats.Eq.fromUniversalEquals implicit val showGmosDisperserOrder: cats.Show[GmosDisperserOrder] = cats.Show.fromToString - implicit val jsonEncoderGmosDisperserOrder: io.circe.Encoder[GmosDisperserOrder] = io.circe.Encoder.encodeString.contramap[GmosDisperserOrder]({ + implicit val jsonEncoderGmosDisperserOrder: io.circe.Encoder[GmosDisperserOrder] = io.circe.Encoder.encodeString.contramap[GmosDisperserOrder] { case Zero => "ZERO" case One => "ONE" case Two => "TWO" - }) + } implicit val jsonDecoderGmosDisperserOrder: io.circe.Decoder[GmosDisperserOrder] = io.circe.Decoder.decodeString.emap(_ match { case "ZERO" => Right(Zero) @@ -477,7 +477,7 @@ object LucumaODB { case object Six extends GmosDtax() implicit val eqGmosDtax: cats.Eq[GmosDtax] = cats.Eq.fromUniversalEquals implicit val showGmosDtax: cats.Show[GmosDtax] = cats.Show.fromToString - implicit val jsonEncoderGmosDtax: io.circe.Encoder[GmosDtax] = io.circe.Encoder.encodeString.contramap[GmosDtax]({ + implicit val jsonEncoderGmosDtax: io.circe.Encoder[GmosDtax] = io.circe.Encoder.encodeString.contramap[GmosDtax] { case MinusSix => "MINUS_SIX" case MinusFive => "MINUS_FIVE" case MinusFour => "MINUS_FOUR" @@ -491,7 +491,7 @@ object LucumaODB { case Four => "FOUR" case Five => "FIVE" case Six => "SIX" - }) + } implicit val jsonDecoderGmosDtax: io.circe.Decoder[GmosDtax] = io.circe.Decoder.decodeString.emap(_ match { case "MINUS_SIX" => Right(MinusSix) @@ -529,10 +529,10 @@ object LucumaODB { case object Off extends GmosEOffsetting() implicit val eqGmosEOffsetting: cats.Eq[GmosEOffsetting] = cats.Eq.fromUniversalEquals implicit val showGmosEOffsetting: cats.Show[GmosEOffsetting] = cats.Show.fromToString - implicit val jsonEncoderGmosEOffsetting: io.circe.Encoder[GmosEOffsetting] = io.circe.Encoder.encodeString.contramap[GmosEOffsetting]({ + implicit val jsonEncoderGmosEOffsetting: io.circe.Encoder[GmosEOffsetting] = io.circe.Encoder.encodeString.contramap[GmosEOffsetting] { case On => "ON" case Off => "OFF" - }) + } implicit val jsonDecoderGmosEOffsetting: io.circe.Decoder[GmosEOffsetting] = io.circe.Decoder.decodeString.emap(_ match { case "ON" => Right(On) @@ -554,7 +554,7 @@ object LucumaODB { case object R150G5308 extends GmosNorthDisperser() implicit val eqGmosNorthDisperser: cats.Eq[GmosNorthDisperser] = cats.Eq.fromUniversalEquals implicit val showGmosNorthDisperser: cats.Show[GmosNorthDisperser] = cats.Show.fromToString - implicit val jsonEncoderGmosNorthDisperser: io.circe.Encoder[GmosNorthDisperser] = io.circe.Encoder.encodeString.contramap[GmosNorthDisperser]({ + implicit val jsonEncoderGmosNorthDisperser: io.circe.Encoder[GmosNorthDisperser] = io.circe.Encoder.encodeString.contramap[GmosNorthDisperser] { case B1200G5301 => "B1200_G5301" case R831G5302 => "R831_G5302" case B600G5303 => "B600_G5303" @@ -563,7 +563,7 @@ object LucumaODB { case R400G5305 => "R400_G5305" case R150G5306 => "R150_G5306" case R150G5308 => "R150_G5308" - }) + } implicit val jsonDecoderGmosNorthDisperser: io.circe.Decoder[GmosNorthDisperser] = io.circe.Decoder.decodeString.emap(_ match { case "B1200_G5301" => Right(B1200G5301) @@ -615,7 +615,7 @@ object LucumaODB { case object UPrime extends GmosNorthFilter() implicit val eqGmosNorthFilter: cats.Eq[GmosNorthFilter] = cats.Eq.fromUniversalEquals implicit val showGmosNorthFilter: cats.Show[GmosNorthFilter] = cats.Show.fromToString - implicit val jsonEncoderGmosNorthFilter: io.circe.Encoder[GmosNorthFilter] = io.circe.Encoder.encodeString.contramap[GmosNorthFilter]({ + implicit val jsonEncoderGmosNorthFilter: io.circe.Encoder[GmosNorthFilter] = io.circe.Encoder.encodeString.contramap[GmosNorthFilter] { case GPrime => "G_PRIME" case RPrime => "R_PRIME" case IPrime => "I_PRIME" @@ -642,7 +642,7 @@ object LucumaODB { case IPrimeCaT => "I_PRIME_CA_T" case ZPrimeCaT => "Z_PRIME_CA_T" case UPrime => "U_PRIME" - }) + } implicit val jsonDecoderGmosNorthFilter: io.circe.Decoder[GmosNorthFilter] = io.circe.Decoder.decodeString.emap(_ match { case "G_PRIME" => Right(GPrime) @@ -720,7 +720,7 @@ object LucumaODB { case object Ifu3 extends GmosNorthFpu() implicit val eqGmosNorthFpu: cats.Eq[GmosNorthFpu] = cats.Eq.fromUniversalEquals implicit val showGmosNorthFpu: cats.Show[GmosNorthFpu] = cats.Show.fromToString - implicit val jsonEncoderGmosNorthFpu: io.circe.Encoder[GmosNorthFpu] = io.circe.Encoder.encodeString.contramap[GmosNorthFpu]({ + implicit val jsonEncoderGmosNorthFpu: io.circe.Encoder[GmosNorthFpu] = io.circe.Encoder.encodeString.contramap[GmosNorthFpu] { case Ns0 => "NS0" case Ns1 => "NS1" case Ns2 => "NS2" @@ -737,7 +737,7 @@ object LucumaODB { case Ifu1 => "IFU1" case Ifu2 => "IFU2" case Ifu3 => "IFU3" - }) + } implicit val jsonDecoderGmosNorthFpu: io.circe.Decoder[GmosNorthFpu] = io.circe.Decoder.decodeString.emap(_ match { case "NS0" => Right(Ns0) @@ -783,12 +783,12 @@ object LucumaODB { case object FollowZ extends GmosNorthStageMode() implicit val eqGmosNorthStageMode: cats.Eq[GmosNorthStageMode] = cats.Eq.fromUniversalEquals implicit val showGmosNorthStageMode: cats.Show[GmosNorthStageMode] = cats.Show.fromToString - implicit val jsonEncoderGmosNorthStageMode: io.circe.Encoder[GmosNorthStageMode] = io.circe.Encoder.encodeString.contramap[GmosNorthStageMode]({ + implicit val jsonEncoderGmosNorthStageMode: io.circe.Encoder[GmosNorthStageMode] = io.circe.Encoder.encodeString.contramap[GmosNorthStageMode] { case NoFollow => "NO_FOLLOW" case FollowXyz => "FOLLOW_XYZ" case FollowXy => "FOLLOW_XY" case FollowZ => "FOLLOW_Z" - }) + } implicit val jsonDecoderGmosNorthStageMode: io.circe.Decoder[GmosNorthStageMode] = io.circe.Decoder.decodeString.emap(_ match { case "NO_FOLLOW" => Right(NoFollow) @@ -813,7 +813,7 @@ object LucumaODB { case object Custom extends GmosRoi() implicit val eqGmosRoi: cats.Eq[GmosRoi] = cats.Eq.fromUniversalEquals implicit val showGmosRoi: cats.Show[GmosRoi] = cats.Show.fromToString - implicit val jsonEncoderGmosRoi: io.circe.Encoder[GmosRoi] = io.circe.Encoder.encodeString.contramap[GmosRoi]({ + implicit val jsonEncoderGmosRoi: io.circe.Encoder[GmosRoi] = io.circe.Encoder.encodeString.contramap[GmosRoi] { case FullFrame => "FULL_FRAME" case Ccd2 => "CCD2" case CentralSpectrum => "CENTRAL_SPECTRUM" @@ -821,7 +821,7 @@ object LucumaODB { case TopSpectrum => "TOP_SPECTRUM" case BottomSpectrum => "BOTTOM_SPECTRUM" case Custom => "CUSTOM" - }) + } implicit val jsonDecoderGmosRoi: io.circe.Decoder[GmosRoi] = io.circe.Decoder.decodeString.emap(_ match { case "FULL_FRAME" => Right(FullFrame) @@ -851,14 +851,14 @@ object LucumaODB { case object R150G5326 extends GmosSouthDisperser() implicit val eqGmosSouthDisperser: cats.Eq[GmosSouthDisperser] = cats.Eq.fromUniversalEquals implicit val showGmosSouthDisperser: cats.Show[GmosSouthDisperser] = cats.Show.fromToString - implicit val jsonEncoderGmosSouthDisperser: io.circe.Encoder[GmosSouthDisperser] = io.circe.Encoder.encodeString.contramap[GmosSouthDisperser]({ + implicit val jsonEncoderGmosSouthDisperser: io.circe.Encoder[GmosSouthDisperser] = io.circe.Encoder.encodeString.contramap[GmosSouthDisperser] { case B1200G5321 => "B1200_G5321" case R831G5322 => "R831_G5322" case B600G5323 => "B600_G5323" case R600G5324 => "R600_G5324" case R400G5325 => "R400_G5325" case R150G5326 => "R150_G5326" - }) + } implicit val jsonDecoderGmosSouthDisperser: io.circe.Decoder[GmosSouthDisperser] = io.circe.Decoder.decodeString.emap(_ match { case "B1200_G5321" => Right(B1200G5321) @@ -908,7 +908,7 @@ object LucumaODB { case object Lya395 extends GmosSouthFilter() implicit val eqGmosSouthFilter: cats.Eq[GmosSouthFilter] = cats.Eq.fromUniversalEquals implicit val showGmosSouthFilter: cats.Show[GmosSouthFilter] = cats.Show.fromToString - implicit val jsonEncoderGmosSouthFilter: io.circe.Encoder[GmosSouthFilter] = io.circe.Encoder.encodeString.contramap[GmosSouthFilter]({ + implicit val jsonEncoderGmosSouthFilter: io.circe.Encoder[GmosSouthFilter] = io.circe.Encoder.encodeString.contramap[GmosSouthFilter] { case UPrime => "U_PRIME" case GPrime => "G_PRIME" case RPrime => "R_PRIME" @@ -937,7 +937,7 @@ object LucumaODB { case HeIi => "HE_II" case HeIic => "HE_IIC" case Lya395 => "LYA395" - }) + } implicit val jsonDecoderGmosSouthFilter: io.circe.Decoder[GmosSouthFilter] = io.circe.Decoder.decodeString.emap(_ match { case "U_PRIME" => Right(UPrime) @@ -1007,12 +1007,12 @@ object LucumaODB { case object FollowZ extends GmosSouthStageMode() implicit val eqGmosSouthStageMode: cats.Eq[GmosSouthStageMode] = cats.Eq.fromUniversalEquals implicit val showGmosSouthStageMode: cats.Show[GmosSouthStageMode] = cats.Show.fromToString - implicit val jsonEncoderGmosSouthStageMode: io.circe.Encoder[GmosSouthStageMode] = io.circe.Encoder.encodeString.contramap[GmosSouthStageMode]({ + implicit val jsonEncoderGmosSouthStageMode: io.circe.Encoder[GmosSouthStageMode] = io.circe.Encoder.encodeString.contramap[GmosSouthStageMode] { case NoFollow => "NO_FOLLOW" case FollowXyz => "FOLLOW_XYZ" case FollowXy => "FOLLOW_XY" case FollowZ => "FOLLOW_Z" - }) + } implicit val jsonDecoderGmosSouthStageMode: io.circe.Decoder[GmosSouthStageMode] = io.circe.Decoder.decodeString.emap(_ match { case "NO_FOLLOW" => Right(NoFollow) @@ -1033,11 +1033,11 @@ object LucumaODB { case object Four extends GmosXBinning() implicit val eqGmosXBinning: cats.Eq[GmosXBinning] = cats.Eq.fromUniversalEquals implicit val showGmosXBinning: cats.Show[GmosXBinning] = cats.Show.fromToString - implicit val jsonEncoderGmosXBinning: io.circe.Encoder[GmosXBinning] = io.circe.Encoder.encodeString.contramap[GmosXBinning]({ + implicit val jsonEncoderGmosXBinning: io.circe.Encoder[GmosXBinning] = io.circe.Encoder.encodeString.contramap[GmosXBinning] { case One => "ONE" case Two => "TWO" case Four => "FOUR" - }) + } implicit val jsonDecoderGmosXBinning: io.circe.Decoder[GmosXBinning] = io.circe.Decoder.decodeString.emap(_ match { case "ONE" => Right(One) @@ -1056,11 +1056,11 @@ object LucumaODB { case object Four extends GmosYBinning() implicit val eqGmosYBinning: cats.Eq[GmosYBinning] = cats.Eq.fromUniversalEquals implicit val showGmosYBinning: cats.Show[GmosYBinning] = cats.Show.fromToString - implicit val jsonEncoderGmosYBinning: io.circe.Encoder[GmosYBinning] = io.circe.Encoder.encodeString.contramap[GmosYBinning]({ + implicit val jsonEncoderGmosYBinning: io.circe.Encoder[GmosYBinning] = io.circe.Encoder.encodeString.contramap[GmosYBinning] { case One => "ONE" case Two => "TWO" case Four => "FOUR" - }) + } implicit val jsonDecoderGmosYBinning: io.circe.Decoder[GmosYBinning] = io.circe.Decoder.decodeString.emap(_ match { case "ONE" => Right(One) @@ -1085,7 +1085,7 @@ object LucumaODB { case object TwoPointZero extends ImageQuality() implicit val eqImageQuality: cats.Eq[ImageQuality] = cats.Eq.fromUniversalEquals implicit val showImageQuality: cats.Show[ImageQuality] = cats.Show.fromToString - implicit val jsonEncoderImageQuality: io.circe.Encoder[ImageQuality] = io.circe.Encoder.encodeString.contramap[ImageQuality]({ + implicit val jsonEncoderImageQuality: io.circe.Encoder[ImageQuality] = io.circe.Encoder.encodeString.contramap[ImageQuality] { case PointOne => "POINT_ONE" case PointTwo => "POINT_TWO" case PointThree => "POINT_THREE" @@ -1095,7 +1095,7 @@ object LucumaODB { case OnePointZero => "ONE_POINT_ZERO" case OnePointFive => "ONE_POINT_FIVE" case TwoPointZero => "TWO_POINT_ZERO" - }) + } implicit val jsonDecoderImageQuality: io.circe.Decoder[ImageQuality] = io.circe.Decoder.decodeString.emap(_ match { case "POINT_ONE" => Right(PointOne) @@ -1139,7 +1139,7 @@ object LucumaODB { case object Ghost extends InstrumentType() implicit val eqInstrumentType: cats.Eq[InstrumentType] = cats.Eq.fromUniversalEquals implicit val showInstrumentType: cats.Show[InstrumentType] = cats.Show.fromToString - implicit val jsonEncoderInstrumentType: io.circe.Encoder[InstrumentType] = io.circe.Encoder.encodeString.contramap[InstrumentType]({ + implicit val jsonEncoderInstrumentType: io.circe.Encoder[InstrumentType] = io.circe.Encoder.encodeString.contramap[InstrumentType] { case Phoenix => "PHOENIX" case Michelle => "MICHELLE" case Gnirs => "GNIRS" @@ -1156,7 +1156,7 @@ object LucumaODB { case Visitor => "VISITOR" case Flamingos2 => "FLAMINGOS2" case Ghost => "GHOST" - }) + } implicit val jsonDecoderInstrumentType: io.circe.Decoder[InstrumentType] = io.circe.Decoder.decodeString.emap(_ match { case "PHOENIX" => Right(Phoenix) @@ -1218,7 +1218,7 @@ object LucumaODB { case object Ap extends MagnitudeBand() implicit val eqMagnitudeBand: cats.Eq[MagnitudeBand] = cats.Eq.fromUniversalEquals implicit val showMagnitudeBand: cats.Show[MagnitudeBand] = cats.Show.fromToString - implicit val jsonEncoderMagnitudeBand: io.circe.Encoder[MagnitudeBand] = io.circe.Encoder.encodeString.contramap[MagnitudeBand]({ + implicit val jsonEncoderMagnitudeBand: io.circe.Encoder[MagnitudeBand] = io.circe.Encoder.encodeString.contramap[MagnitudeBand] { case SloanU => "SLOAN_U" case SloanG => "SLOAN_G" case SloanR => "SLOAN_R" @@ -1239,7 +1239,7 @@ object LucumaODB { case N => "N" case Q => "Q" case Ap => "AP" - }) + } implicit val jsonDecoderMagnitudeBand: io.circe.Decoder[MagnitudeBand] = io.circe.Decoder.decodeString.emap(_ match { case "SLOAN_U" => Right(SloanU) @@ -1292,11 +1292,11 @@ object LucumaODB { case object Jy extends MagnitudeSystem() implicit val eqMagnitudeSystem: cats.Eq[MagnitudeSystem] = cats.Eq.fromUniversalEquals implicit val showMagnitudeSystem: cats.Show[MagnitudeSystem] = cats.Show.fromToString - implicit val jsonEncoderMagnitudeSystem: io.circe.Encoder[MagnitudeSystem] = io.circe.Encoder.encodeString.contramap[MagnitudeSystem]({ + implicit val jsonEncoderMagnitudeSystem: io.circe.Encoder[MagnitudeSystem] = io.circe.Encoder.encodeString.contramap[MagnitudeSystem] { case Vega => "VEGA" case Ab => "AB" case Jy => "JY" - }) + } implicit val jsonDecoderMagnitudeSystem: io.circe.Decoder[MagnitudeSystem] = io.circe.Decoder.decodeString.emap(_ match { case "VEGA" => Right(Vega) @@ -1314,10 +1314,10 @@ object LucumaODB { case object IsNotMosPreImaging extends MosPreImaging() implicit val eqMosPreImaging: cats.Eq[MosPreImaging] = cats.Eq.fromUniversalEquals implicit val showMosPreImaging: cats.Show[MosPreImaging] = cats.Show.fromToString - implicit val jsonEncoderMosPreImaging: io.circe.Encoder[MosPreImaging] = io.circe.Encoder.encodeString.contramap[MosPreImaging]({ + implicit val jsonEncoderMosPreImaging: io.circe.Encoder[MosPreImaging] = io.circe.Encoder.encodeString.contramap[MosPreImaging] { case IsMosPreImaging => "IS_MOS_PRE_IMAGING" case IsNotMosPreImaging => "IS_NOT_MOS_PRE_IMAGING" - }) + } implicit val jsonDecoderMosPreImaging: io.circe.Decoder[MosPreImaging] = io.circe.Decoder.decodeString.emap(_ match { case "IS_MOS_PRE_IMAGING" => Right(IsMosPreImaging) @@ -1339,7 +1339,7 @@ object LucumaODB { case object Observed extends ObsStatus() implicit val eqObsStatus: cats.Eq[ObsStatus] = cats.Eq.fromUniversalEquals implicit val showObsStatus: cats.Show[ObsStatus] = cats.Show.fromToString - implicit val jsonEncoderObsStatus: io.circe.Encoder[ObsStatus] = io.circe.Encoder.encodeString.contramap[ObsStatus]({ + implicit val jsonEncoderObsStatus: io.circe.Encoder[ObsStatus] = io.circe.Encoder.encodeString.contramap[ObsStatus] { case New => "NEW" case Included => "INCLUDED" case Proposed => "PROPOSED" @@ -1348,7 +1348,7 @@ object LucumaODB { case Ready => "READY" case Ongoing => "ONGOING" case Observed => "OBSERVED" - }) + } implicit val jsonDecoderObsStatus: io.circe.Decoder[ObsStatus] = io.circe.Decoder.decodeString.emap(_ match { case "NEW" => Right(New) @@ -1376,10 +1376,10 @@ object LucumaODB { case object Milliarcseconds extends ParallaxUnits() implicit val eqParallaxUnits: cats.Eq[ParallaxUnits] = cats.Eq.fromUniversalEquals implicit val showParallaxUnits: cats.Show[ParallaxUnits] = cats.Show.fromToString - implicit val jsonEncoderParallaxUnits: io.circe.Encoder[ParallaxUnits] = io.circe.Encoder.encodeString.contramap[ParallaxUnits]({ + implicit val jsonEncoderParallaxUnits: io.circe.Encoder[ParallaxUnits] = io.circe.Encoder.encodeString.contramap[ParallaxUnits] { case Microarcseconds => "MICROARCSECONDS" case Milliarcseconds => "MILLIARCSECONDS" - }) + } implicit val jsonDecoderParallaxUnits: io.circe.Decoder[ParallaxUnits] = io.circe.Decoder.decodeString.emap(_ match { case "MICROARCSECONDS" => Right(Microarcseconds) @@ -1395,10 +1395,10 @@ object LucumaODB { case object MilliarcsecondsPerYear extends ProperMotionComponentUnits() implicit val eqProperMotionComponentUnits: cats.Eq[ProperMotionComponentUnits] = cats.Eq.fromUniversalEquals implicit val showProperMotionComponentUnits: cats.Show[ProperMotionComponentUnits] = cats.Show.fromToString - implicit val jsonEncoderProperMotionComponentUnits: io.circe.Encoder[ProperMotionComponentUnits] = io.circe.Encoder.encodeString.contramap[ProperMotionComponentUnits]({ + implicit val jsonEncoderProperMotionComponentUnits: io.circe.Encoder[ProperMotionComponentUnits] = io.circe.Encoder.encodeString.contramap[ProperMotionComponentUnits] { case MicroarcsecondsPerYear => "MICROARCSECONDS_PER_YEAR" case MilliarcsecondsPerYear => "MILLIARCSECONDS_PER_YEAR" - }) + } implicit val jsonDecoderProperMotionComponentUnits: io.circe.Decoder[ProperMotionComponentUnits] = io.circe.Decoder.decodeString.emap(_ match { case "MICROARCSECONDS_PER_YEAR" => Right(MicroarcsecondsPerYear) @@ -1415,11 +1415,11 @@ object LucumaODB { case object KilometersPerSecond extends RadialVelocityUnits() implicit val eqRadialVelocityUnits: cats.Eq[RadialVelocityUnits] = cats.Eq.fromUniversalEquals implicit val showRadialVelocityUnits: cats.Show[RadialVelocityUnits] = cats.Show.fromToString - implicit val jsonEncoderRadialVelocityUnits: io.circe.Encoder[RadialVelocityUnits] = io.circe.Encoder.encodeString.contramap[RadialVelocityUnits]({ + implicit val jsonEncoderRadialVelocityUnits: io.circe.Encoder[RadialVelocityUnits] = io.circe.Encoder.encodeString.contramap[RadialVelocityUnits] { case CentimetersPerSecond => "CENTIMETERS_PER_SECOND" case MetersPerSecond => "METERS_PER_SECOND" case KilometersPerSecond => "KILOMETERS_PER_SECOND" - }) + } implicit val jsonDecoderRadialVelocityUnits: io.circe.Decoder[RadialVelocityUnits] = io.circe.Decoder.decodeString.emap(_ match { case "CENTIMETERS_PER_SECOND" => Right(CentimetersPerSecond) @@ -1438,11 +1438,11 @@ object LucumaODB { case object Hours extends RightAscensionUnits() implicit val eqRightAscensionUnits: cats.Eq[RightAscensionUnits] = cats.Eq.fromUniversalEquals implicit val showRightAscensionUnits: cats.Show[RightAscensionUnits] = cats.Show.fromToString - implicit val jsonEncoderRightAscensionUnits: io.circe.Encoder[RightAscensionUnits] = io.circe.Encoder.encodeString.contramap[RightAscensionUnits]({ + implicit val jsonEncoderRightAscensionUnits: io.circe.Encoder[RightAscensionUnits] = io.circe.Encoder.encodeString.contramap[RightAscensionUnits] { case Microarcseconds => "MICROARCSECONDS" case Degrees => "DEGREES" case Hours => "HOURS" - }) + } implicit val jsonDecoderRightAscensionUnits: io.circe.Decoder[RightAscensionUnits] = io.circe.Decoder.decodeString.emap(_ match { case "MICROARCSECONDS" => Right(Microarcseconds) @@ -1462,12 +1462,12 @@ object LucumaODB { case object Bright extends SkyBackground() implicit val eqSkyBackground: cats.Eq[SkyBackground] = cats.Eq.fromUniversalEquals implicit val showSkyBackground: cats.Show[SkyBackground] = cats.Show.fromToString - implicit val jsonEncoderSkyBackground: io.circe.Encoder[SkyBackground] = io.circe.Encoder.encodeString.contramap[SkyBackground]({ + implicit val jsonEncoderSkyBackground: io.circe.Encoder[SkyBackground] = io.circe.Encoder.encodeString.contramap[SkyBackground] { case Darkest => "DARKEST" case Dark => "DARK" case Gray => "GRAY" case Bright => "BRIGHT" - }) + } implicit val jsonDecoderSkyBackground: io.circe.Decoder[SkyBackground] = io.circe.Decoder.decodeString.emap(_ match { case "DARKEST" => Right(Darkest) @@ -1490,13 +1490,13 @@ object LucumaODB { case object SmartGcal extends StepType() implicit val eqStepType: cats.Eq[StepType] = cats.Eq.fromUniversalEquals implicit val showStepType: cats.Show[StepType] = cats.Show.fromToString - implicit val jsonEncoderStepType: io.circe.Encoder[StepType] = io.circe.Encoder.encodeString.contramap[StepType]({ + implicit val jsonEncoderStepType: io.circe.Encoder[StepType] = io.circe.Encoder.encodeString.contramap[StepType] { case Bias => "BIAS" case Dark => "DARK" case Gcal => "GCAL" case Science => "SCIENCE" case SmartGcal => "SMART_GCAL" - }) + } implicit val jsonDecoderStepType: io.circe.Decoder[StepType] = io.circe.Decoder.decodeString.emap(_ match { case "BIAS" => Right(Bias) @@ -1520,12 +1520,12 @@ object LucumaODB { case object Wet extends WaterVapor() implicit val eqWaterVapor: cats.Eq[WaterVapor] = cats.Eq.fromUniversalEquals implicit val showWaterVapor: cats.Show[WaterVapor] = cats.Show.fromToString - implicit val jsonEncoderWaterVapor: io.circe.Encoder[WaterVapor] = io.circe.Encoder.encodeString.contramap[WaterVapor]({ + implicit val jsonEncoderWaterVapor: io.circe.Encoder[WaterVapor] = io.circe.Encoder.encodeString.contramap[WaterVapor] { case VeryDry => "VERY_DRY" case Dry => "DRY" case Median => "MEDIAN" case Wet => "WET" - }) + } implicit val jsonDecoderWaterVapor: io.circe.Decoder[WaterVapor] = io.circe.Decoder.decodeString.emap(_ match { case "VERY_DRY" => Right(VeryDry) diff --git a/gen/output/src/main/scala/test/StarWarsSchema.scala b/gen/output/src/main/scala/test/StarWarsSchema.scala index 73c7e063..6e266e42 100644 --- a/gen/output/src/main/scala/test/StarWarsSchema.scala +++ b/gen/output/src/main/scala/test/StarWarsSchema.scala @@ -19,11 +19,11 @@ object StarWars { case object Jedi extends Episode() implicit val eqEpisode: cats.Eq[Episode] = cats.Eq.fromUniversalEquals implicit val showEpisode: cats.Show[Episode] = cats.Show.fromToString - implicit val jsonEncoderEpisode: io.circe.Encoder[Episode] = io.circe.Encoder.encodeString.contramap[Episode]({ + implicit val jsonEncoderEpisode: io.circe.Encoder[Episode] = io.circe.Encoder.encodeString.contramap[Episode] { case Newhope => "NEWHOPE" case Empire => "EMPIRE" case Jedi => "JEDI" - }) + } implicit val jsonDecoderEpisode: io.circe.Decoder[Episode] = io.circe.Decoder.decodeString.emap(_ match { case "NEWHOPE" => Right(Newhope) From 20e0353a67e6e56c734ab0c00d9ef22834d01bac Mon Sep 17 00:00:00 2001 From: Hugo van Rijswijk Date: Mon, 18 Mar 2024 20:34:54 +0100 Subject: [PATCH 5/6] Fix compile error --- gen/rules/src/main/scala/clue/gen/QueryGen.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gen/rules/src/main/scala/clue/gen/QueryGen.scala b/gen/rules/src/main/scala/clue/gen/QueryGen.scala index ea15d9d4..ff725790 100644 --- a/gen/rules/src/main/scala/clue/gen/QueryGen.scala +++ b/gen/rules/src/main/scala/clue/gen/QueryGen.scala @@ -121,18 +121,18 @@ trait QueryGen extends Generator { protected[this] def compileType(schema: Schema, tpe: Ast.Type): Result[GType] = { def loop(tpe: Ast.Type, nonNull: Boolean): Result[GType] = tpe match { - case Ast.Type.NonNull(Left(named)) => loop(named, true) - case Ast.Type.NonNull(Right(list)) => loop(list, true) + case Ast.Type.NonNull(Left(named)) => loop(named, nonNull = true) + case Ast.Type.NonNull(Right(list)) => loop(list, nonNull = true) case Ast.Type.List(elem) => - loop(elem, false).map(e => if (nonNull) ListType(e) else NullableType(ListType(e))) + loop(elem, nonNull = false).map(e => if (nonNull) ListType(e) else NullableType(ListType(e))) case Ast.Type.Named(name) => schema.definition(name.value) match { case None => Result.internalError(s"Undefine typed '${name.value}'") - case Some(tpe) => Result.success(if (nonNull) tpe else NullableType(tpe)) + case Some(tp) => Result.success(if (nonNull) tp else NullableType(tp)) } } - loop(tpe, false) + loop(tpe, nonNull = false) } // // END COPIED FROM GRACKLE. From b442664433895fd7600a430770c02b21c33df2f0 Mon Sep 17 00:00:00 2001 From: Hugo van Rijswijk Date: Mon, 18 Mar 2024 20:37:15 +0100 Subject: [PATCH 6/6] Formatting --- gen/rules/src/main/scala/clue/gen/QueryGen.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gen/rules/src/main/scala/clue/gen/QueryGen.scala b/gen/rules/src/main/scala/clue/gen/QueryGen.scala index ff725790..7632dcb9 100644 --- a/gen/rules/src/main/scala/clue/gen/QueryGen.scala +++ b/gen/rules/src/main/scala/clue/gen/QueryGen.scala @@ -124,10 +124,12 @@ trait QueryGen extends Generator { case Ast.Type.NonNull(Left(named)) => loop(named, nonNull = true) case Ast.Type.NonNull(Right(list)) => loop(list, nonNull = true) case Ast.Type.List(elem) => - loop(elem, nonNull = false).map(e => if (nonNull) ListType(e) else NullableType(ListType(e))) + loop(elem, nonNull = false).map(e => + if (nonNull) ListType(e) else NullableType(ListType(e)) + ) case Ast.Type.Named(name) => schema.definition(name.value) match { - case None => Result.internalError(s"Undefine typed '${name.value}'") + case None => Result.internalError(s"Undefine typed '${name.value}'") case Some(tp) => Result.success(if (nonNull) tp else NullableType(tp)) } }