Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
tpolecat committed Sep 7, 2023
1 parent 2555648 commit 6f9077a
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@


enum Partner { DUMMY }
enum ConditionsMeasurementSource { DUMMY }
enum SeeingTrend { DUMMY }
enum ConditionsExpectationType { DUMMY }
enum ObsAttachmentType { DUMMY }
enum FilterType { DUMMY }
enum ProposalAttachmentType { DUMMY }




"DatasetEvent creation parameters."
input AddDatasetEventInput {

Expand Down Expand Up @@ -3074,7 +3087,7 @@ type RecordGmosSouthVisitResult {
Right Ascension, choose one of the available units
"""
input RightAscensionInput {
microarcseconds: Long @deprecated
microarcseconds: Long # @deprecated
microseconds: Long
degrees: BigDecimal
hours: BigDecimal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

package lucuma.odb.graphql.binding

import edu.gemini.grackle.Ast.Value.EnumValue
import edu.gemini.grackle.Ast.Name
import edu.gemini.grackle.Value.EnumValue

val EnumBinding: Matcher[Name] =
primitiveBinding("Enum") { case EnumValue(name) => name }
val EnumBinding: Matcher[String] =
primitiveBinding("EnumValue") { case EnumValue(name) => name }
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import io.circe.Json
import lucuma.core.util.Enumerated

def enumeratedBinding[A](implicit ev: Enumerated[A]): Matcher[A] =
EnumBinding.map(n => Json.fromString(n.value)).emap { j =>
EnumBinding.map(n => Json.fromString(n)).emap { j =>
ev.decodeJson(j).leftMap(_.message)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ package lucuma.odb.graphql.binding
import lucuma.odb.data.Tag

val TagBinding =
EnumBinding.map(n => Tag(n.value.toLowerCase))
EnumBinding.map(n => Tag(n.toLowerCase))
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import lucuma.odb.graphql.binding._
BigDecimalBinding("value", rValue),
EnumBinding("units", rEnum)
) =>
(rValue, rEnum.map(_.value)).parTupled.flatMap {
(rValue, rEnum).parTupled.flatMap {
case (value, label) =>
handler.lift((value, label)) match {
case Some(r) => r
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ trait MutationMapping[F[_]] extends Predicates[F] {
def apply[I: ClassTag: TypeName](fieldName: String, inputBinding: Matcher[I])(f: (I, Query) => F[Result[Query]]) =
new MutationField {
val FieldMapping =
RootEffect.computeChild(fieldName) { (child, tpe, env) =>
RootEffect.computeChild(fieldName) { (child, _, _) =>
child match {
case Environment(x, child2) =>
case Environment(env, child2) =>
Nested(env.getR[I]("input").flatTraverse(i => f(i, child2)))
.map(child3 => Environment(x, child3))
.map(child3 => Environment(env, child3))
.value
case _ =>
Result.failure(s"Unexpected: $child").pure[F]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ trait SubscriptionMapping[F[_]] extends Predicates[F] {
def apply[I: ClassTag: TypeName](fieldName: String, inputBinding: Matcher[I])(f: (I, Query) => Stream[F, Result[Query]]) =
new SubscriptionField {
val FieldMapping =
RootStream.computeChild(fieldName) { (child, tpe, env) =>
RootStream.computeChild(fieldName) { (child, _, _) =>
child match
case Environment(a, child2) =>
case Environment(env, child2) =>
Nested(env.getR[I]("input").flatTraverse(f(_, child2)))
.map(child3 => Environment(a, child3))
.map(child3 => Environment(env, child3))
.value
case _ =>
Result.failure(s"Unexpected: $child").pure[Stream[F, *]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import edu.gemini.grackle.Schema
import edu.gemini.grackle.Type
import org.tpolecat.sourcepos.SourcePos
import edu.gemini.grackle.DirectiveDef
import edu.gemini.grackle.EnumType

/** A mixin that provides Semigroup[Schema]. */
trait SchemaSemigroup[F[_]] extends Mapping[F] {
Expand All @@ -35,6 +36,13 @@ trait SchemaSemigroup[F[_]] extends Mapping[F] {
(a.interfaces ++ b.interfaces).distinctBy(_.name),
(a.directives ++ b.directives).distinctBy(_.name),
)
case ((a: EnumType, b: EnumType)) if sameName(a, b) =>
EnumType(
a.name,
a.description,
(a.enumValues ++ b.enumValues).distinctBy(_.name).filterNot(_.name == "DUMMY"),
(a.directives ++ b.directives).distinctBy(_.name)
)
// todo: other named types
case (a, _) => a
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class addConditionsEntry extends OdbSuite {
}
""",
expected = Left(List(
"Value of type ConditionsMeasurementSource required for 'source'"
"Value of type ConditionsMeasurementSource required for 'source' in field 'addConditionsEntry' of type 'Mutation'"
))
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class createProgram extends OdbSuite {
"c_mod_pi_user_id" : true,
"c_mod_program_id" : true,
"c_new_pi_user_id" : "u-1",
"c_new_program_id" : "p-108",
"c_new_program_id" : ${pid},
"c_mod_pi_user_type" : true,
"c_new_pi_user_type" : "standard",
"c_mod_pts_execution" : true,
Expand Down

0 comments on commit 6f9077a

Please sign in to comment.