diff options
Diffstat (limited to 'app/graphql/types/notes')
-rw-r--r-- | app/graphql/types/notes/update_diff_image_position_input_type.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/graphql/types/notes/update_diff_image_position_input_type.rb b/app/graphql/types/notes/update_diff_image_position_input_type.rb index af99764f9f2..1b915b65ae9 100644 --- a/app/graphql/types/notes/update_diff_image_position_input_type.rb +++ b/app/graphql/types/notes/update_diff_image_position_input_type.rb @@ -23,6 +23,14 @@ module Types argument :height, GraphQL::INT_TYPE, required: false, description: copy_field_description(Types::Notes::DiffPositionType, :height) + + def prepare + to_h.compact.tap do |properties| + if properties.empty? + raise GraphQL::ExecutionError, "At least one property of `#{self.class.graphql_name}` must be set" + end + end + end end # rubocop: enable Graphql/AuthorizeTypes end |