diff options
Diffstat (limited to 'app/graphql/types')
-rw-r--r-- | app/graphql/types/base_argument.rb | 22 | ||||
-rw-r--r-- | app/graphql/types/permission_types/base_permission_type.rb | 2 |
2 files changed, 1 insertions, 23 deletions
diff --git a/app/graphql/types/base_argument.rb b/app/graphql/types/base_argument.rb index cda7fa4a5df..3b4223c3ba1 100644 --- a/app/graphql/types/base_argument.rb +++ b/app/graphql/types/base_argument.rb @@ -9,29 +9,7 @@ module Types def initialize(*args, **kwargs, &block) @doc_reference = kwargs.delete(:see) - # our custom addition `nullable` which allows us to declare - # an argument that must be provided, even if its value is null. - # When `required: true` then required arguments must not be null. - @gl_required = !!kwargs[:required] - @gl_nullable = kwargs[:required] == :nullable - - # Only valid if an argument is also required. - if @gl_nullable - # Since the framework asserts that "required" means "cannot be null" - # we have to switch off "required" but still do the check in `ready?` behind the scenes - kwargs[:required] = false - end - super(*args, **kwargs, &block) end - - def accepts?(value) - # if the argument is declared as required, it must be included - return false if @gl_required && value == :not_given - # if the argument is declared as required, the value can only be null IF it is also nullable. - return false if @gl_required && value.nil? && !@gl_nullable - - true - end end end diff --git a/app/graphql/types/permission_types/base_permission_type.rb b/app/graphql/types/permission_types/base_permission_type.rb index d45c61f489b..3c0e68bdaf2 100644 --- a/app/graphql/types/permission_types/base_permission_type.rb +++ b/app/graphql/types/permission_types/base_permission_type.rb @@ -21,7 +21,7 @@ module Types kword_args = kword_args.reverse_merge( name: name, type: GraphQL::Types::Boolean, - description: "Indicates the user can perform `#{name}` on this resource", + description: "If `true`, the user can perform `#{name}` on this resource", null: false) field(**kword_args, &block) # rubocop:disable Graphql/Descriptions |