Per the spec, cyclic input object fields of non-nullable list type with non-nullable items are valid since the field value can be an empty list. However, the NoUnbrokenInputCycles rule reports these input objects as invalid.
To reproduce, run the following code:
import graphql.schema.idl.NoopWiringFactory;
import graphql.schema.idl.RuntimeWiring;
import graphql.schema.idl.SchemaGenerator;
import graphql.schema.idl.SchemaParser;
public class Main {
public static void main(String[] args) {
String query = """
input Example {
self: [Example!]!
value: String
}
type Query {
example(example: Example): String
}
""".stripIndent();
TypeDefinitionRegistry typeDefinitionRegistry = new SchemaParser().parse(query);
RuntimeWiring runtimeWiring = RuntimeWiring.newRuntimeWiring().wiringFactory(new NoopWiringFactory()).build();
new SchemaGenerator().makeExecutableSchema(typeDefinitionRegistry, runtimeWiring);
}
}
Observe an InvalidSchemaException is thrown with the message [self!] forms an unsatisfiable cycle
Per the spec, cyclic input object fields of non-nullable list type with non-nullable items are valid since the field value can be an empty list. However, the
NoUnbrokenInputCyclesrule reports these input objects as invalid.To reproduce, run the following code:
Observe an
InvalidSchemaExceptionis thrown with the message[self!] forms an unsatisfiable cycle