Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Scalar types within variables not working #43

Closed
jeggy opened this issue Dec 21, 2018 · 1 comment · Fixed by #46
Closed

Scalar types within variables not working #43

jeggy opened this issue Dec 21, 2018 · 1 comment · Fixed by #46

Comments

@jeggy
Copy link
Contributor

jeggy commented Dec 21, 2018

It's failing when trying to use scalar types within variables. See example below.

// This test should be in `ScalarsSpecificationTest`
@Test
fun `Scalars within input variables`(){
    val schema = KGraphQL.schema {
        floatScalar<Dob> {
            deserialize = ::Dob
            serialize = { (double) -> double }
        }

        query("double"){
            resolver { double : Dob -> double }
        }
    }

    val value = 232.33
    val response = deserialize(schema.execute(
        request = "query customQuery(\$var: Dob!){double(double: \$var)}",
        variables = "{\"var\": $value}"
    ))
    assertThat(response.extract<Double>("data/double"), equalTo(value))
}

Gives:

com.github.pgutkowski.kgraphql.ExecutionException: Failed to coerce 232.33 as com.github.pgutkowski.kgraphql.specification.typesystem.ScalarsSpecificationTest.Dob
@pgutkowski
Copy link
Owner

Your fix will be included in 0.3.1, planned to be relased today.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants