Netflix / dgs-codegen

Apache License 2.0
177 stars 92 forks source link

feat: allow to set default InputValueSerializer #675

Closed dwilkolek closed 2 months ago

dwilkolek commented 2 months ago

Extended GraphQLProjection to allow setting custom InputValueSerializer per thread. This change will allow to use any scalars with DgsClient client and setup them once.

@Test
fun test() {
    InputValueSerializerProvider.serializer = InputValueSerializer(
        mapOf(UUID::class.java to UUIDScalar.INSTANCE.coercing)
    )
    /* line below would fail before */
    val query = DgsClient.buildQuery {
        movies(filter = UUID.randomUUID())
    }
}

closes #455

srinivasankavitha commented 2 months ago

cc @mbossenbroek

mbossenbroek commented 2 months ago

Thanks @dwilkolek for adding this! 👏

dwilkolek commented 2 months ago

No problem, I find this project fascinating. I'll keep an eye for good first issues 😉