laravel-graphql
laravel-graphql copied to clipboard
Detect impossible to resolve validation rules
I found that validating for circular references within Input Objects is an ongoing issue within the specification project: https://github.com/facebook/graphql/issues/189
input Something {
name: String
somethingElse: Something!
}
I suppose we could take it for granted that illegal Input Object definitions will eventually be caught by the schema validation. Lee Byron already stated that he deems it necessary, the question here is just when that will happen.
However, i think we have to consider this from the perspective of laravel as well, since we have an additional layer of validation on top. The following example would be an Input Object definition with Laravel-based validation that cannot possibly work:
class ExampleValidationInputObject extends BaseType
{
protected $inputObject = true;
public function fields()
{
return [
'self' => [
'name' => 'self',
'type' => GraphQL::type('ExampleValidationInputObject'),
'rules' => ['required']
],
];
}
}