diff --git a/core/src/main/scala-2/caliban/schema/SchemaDerivation.scala b/core/src/main/scala-2/caliban/schema/SchemaDerivation.scala index a5c595613c..6089a58717 100644 --- a/core/src/main/scala-2/caliban/schema/SchemaDerivation.scala +++ b/core/src/main/scala-2/caliban/schema/SchemaDerivation.scala @@ -128,8 +128,10 @@ trait CommonSchemaDerivation[R] { ) } + private lazy val enumValue = PureStep(EnumValue(getName(ctx))) + override def resolve(value: T): Step[R] = - if (ctx.isObject) PureStep(EnumValue(getName(ctx))) + if (ctx.isObject) enumValue else if (_isValueType) resolveValueType(value) else objectResolver.resolve(value)