Skip to content

Add optional `nullable` declaration to GraphQL arguments

charlie ablett requested to merge cablett-329617-graphql-nullable-args into master

What does this MR do?

In !60139 (merged) @johnhope and @egrieff noticed that it was a bit awkward not having a way to express "you must provide argument X, but it's OK if it's simply null".

We wound up using the ready? method in a mutation as well as marking the argument as not required. This was better, but it felt a bit naff declaring the argument as "not required, but actually required" due to the lack of required argument nullability in the GraphQL spec.

This MR adds a handy nullable: facet to add to argument declarations, which may only be used when an argument is required (if an argument is not required, it is just noise). It uses ready? under the hood. It also updates the setDueDate mutation to use the new nullable: field.

Related to #329617 (closed)

Screenshots or Screencasts (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by charlie ablett

Merge request reports