Skip to content

Commit

Permalink
Improve resolve performance in Scala 2 derivation (#2239)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostdogpr authored May 19, 2024
1 parent 9641ac8 commit 0e3eaab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/main/scala-2/caliban/schema/SchemaDerivation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 0e3eaab

Please sign in to comment.