Skip to content

Commit

Permalink
Allow ommitting Directive arguments that are non-null if they have de…
Browse files Browse the repository at this point in the history
…faults (#270)

Signed-off-by: Steve Coffman <steve@khanacademy.org>
  • Loading branch information
StevenACoffman committed Jul 15, 2023
1 parent 4b44f9b commit 9fb1c32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion validator/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func validateDirectives(schema *Schema, dirs DirectiveList, location DirectiveLo
}
}
for _, schemaArg := range dirDefinition.Arguments {
if schemaArg.Type.NonNull {
if schemaArg.Type.NonNull && schemaArg.DefaultValue == nil {
if arg := dir.Arguments.ForName(schemaArg.Name); arg == nil || arg.Value.Kind == NullValue {
return gqlerror.ErrorPosf(dir.Position, "Argument %s for directive %s cannot be null.", schemaArg.Name, dir.Name)
}
Expand Down

0 comments on commit 9fb1c32

Please sign in to comment.