Minimally reproduced in this Scastie (which is modified from @ghostdogpr 's Scastie in our chat in Discord around this topic to account for the rules required for @oneOf: (1) the leaf case class must contain exactly 1 non-nullable field, (2) the field names in the leaf cases must be unique, and (3) any objects used in the leaf cases must have a Schema and an ArgBuilder).
Just in case there's some issue with accessing the Scastie content, I'm leaving the code snippet here as well:
import caliban.schema.Annotations.GQLOneOfInput
import caliban.schema.{ArgBuilder, Schema}
//@GQLOneOfInput
sealed trait Clause derives Schema.SemiAuto, ArgBuilder
case class SimpleClause(col: String) extends Clause derives Schema.SemiAuto, ArgBuilder
case class And (andClauses: Seq[Clause]) extends Clause derives Schema.SemiAuto, ArgBuilder
case class Or (orClauses: Seq[Clause]) extends Clause derives Schema.SemiAuto, ArgBuilder
case class Args(clause: Clause) derives Schema.SemiAuto, ArgBuilder
case class Query(test: Args => Int) derives Schema.SemiAuto
println(caliban.render[Query])
If I commented out the @GQLOneOfInput directive, the schema is rendered successfully as:
union Clause = And | Or | SimpleClause
type And {
andClauses: [Clause!]!
}
type Or {
orClauses: [Clause!]!
}
type Query {
test(clause: Clause!): Int!
}
type SimpleClause {
col: String!
}
However, with the directive, the code does not terminate.
Minimally reproduced in this Scastie (which is modified from @ghostdogpr 's Scastie in our chat in Discord around this topic to account for the rules required for
@oneOf: (1) the leaf case class must contain exactly 1 non-nullable field, (2) the field names in the leaf cases must be unique, and (3) any objects used in the leaf cases must have aSchemaand anArgBuilder).Just in case there's some issue with accessing the Scastie content, I'm leaving the code snippet here as well:
If I commented out the
@GQLOneOfInputdirective, the schema is rendered successfully as:However, with the directive, the code does not terminate.