Skip to content

Commit

Permalink
Merge pull request #529 from michludw/scalars-without-apostrophes
Browse files Browse the repository at this point in the history
support for scalar argument without apostrophes
  • Loading branch information
milessabin authored Dec 12, 2023
2 parents e0b85de + 16175f3 commit d5ebe44
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/core/src/main/scala/schema.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,8 @@ object Value {
value.success
case (s: ScalarType, Some(value: BooleanValue)) if !s.isBuiltIn =>
value.success
case (s: ScalarType, Some(enumValue: EnumValue)) if !s.isBuiltIn =>
StringValue(enumValue.name).success

case (IDType, Some(value: IDValue)) =>
value.success
Expand Down
33 changes: 33 additions & 0 deletions modules/core/src/test/scala/compiler/ScalarsSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,39 @@ final class ScalarsSuite extends CatsEffectSuite {
assertIO(res, expected)
}

test("query with scalar argument without apostrophes") {
val query = """
query {
moviesLongerThan(duration: PT3H) {
title
duration
}
}
"""

val expected = json"""
{
"data" : {
"moviesLongerThan" : [
{
"title" : "Celine et Julie Vont en Bateau",
"duration" : "PT3H25M"
},
{
"title" : "L'Amour fou",
"duration" : "PT4H12M"
}
]
}
}
"""

val res = MovieMapping.compileAndRun(query)

assertIO(res, expected)
}


test("query with LocalTime argument") {
val query = """
query {
Expand Down

0 comments on commit d5ebe44

Please sign in to comment.