OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix translation of dry validation contracts
Jan Sandbrink389835e6bfc3
diff --git a/app/contracts/custom_fields/hierarchy/generate_root_contract.rb b/app/contracts/custom_fields/hierarchy/generate_root_contract.rbindex bb8323c8790..108e260f99c 100644--- a/app/contracts/custom_fields/hierarchy/generate_root_contract.rb+++ b/app/contracts/custom_fields/hierarchy/generate_root_contract.rb@@ -30,9 +30,7 @@module CustomFieldsmodule Hierarchy- class GenerateRootContract < Dry::Validation::Contract- config.messages.backend = :i18n-+ class GenerateRootContract < DryApplicationContractparams dorequired(:custom_field).filled(type?: CustomField)enddiff --git a/app/contracts/custom_fields/hierarchy/insert_list_item_contract.rb b/app/contracts/custom_fields/hierarchy/insert_list_item_contract.rbindex 0a4cbb8a46f..2efc10d6603 100644--- a/app/contracts/custom_fields/hierarchy/insert_list_item_contract.rb+++ b/app/contracts/custom_fields/hierarchy/insert_list_item_contract.rb@@ -30,8 +30,7 @@module CustomFieldsmodule Hierarchy- class InsertListItemContract < Dry::Validation::Contract- config.messages.backend = :i18n+ class InsertListItemContract < DryApplicationContractparams dorequired(:parent).filled(type?: CustomField::Hierarchy::Item)diff --git a/app/contracts/custom_fields/hierarchy/insert_scored_item_contract.rb b/app/contracts/custom_fields/hierarchy/insert_scored_item_contract.rbindex 14ec96fefd2..4f95c87cdf9 100644--- a/app/contracts/custom_fields/hierarchy/insert_scored_item_contract.rb+++ b/app/contracts/custom_fields/hierarchy/insert_scored_item_contract.rb@@ -30,9 +30,7 @@module CustomFieldsmodule Hierarchy- class InsertScoredItemContract < Dry::Validation::Contract- config.messages.backend = :i18n-+ class InsertScoredItemContract < DryApplicationContractparams dorequired(:parent).filled(type?: CustomField::Hierarchy::Item)required(:label).filled(:string)diff --git a/app/contracts/custom_fields/hierarchy/update_list_item_contract.rb b/app/contracts/custom_fields/hierarchy/update_list_item_contract.rbindex 7bfbecd13f6..cb302386381 100644--- a/app/contracts/custom_fields/hierarchy/update_list_item_contract.rb+++ b/app/contracts/custom_fields/hierarchy/update_list_item_contract.rb@@ -30,9 +30,7 @@module CustomFieldsmodule Hierarchy- class UpdateListItemContract < Dry::Validation::Contract- config.messages.backend = :i18n-+ class UpdateListItemContract < DryApplicationContractparams dorequired(:item).filled(type?: CustomField::Hierarchy::Item)optional(:label).filled(:string)diff --git a/app/contracts/custom_fields/hierarchy/update_scored_item_contract.rb b/app/contracts/custom_fields/hierarchy/update_scored_item_contract.rbindex cddb5b282e7..7cab92cf8c0 100644--- a/app/contracts/custom_fields/hierarchy/update_scored_item_contract.rb+++ b/app/contracts/custom_fields/hierarchy/update_scored_item_contract.rb@@ -30,8 +30,7 @@module CustomFieldsmodule Hierarchy- class UpdateScoredItemContract < Dry::Validation::Contract- config.messages.backend = :i18n+ class UpdateScoredItemContract < DryApplicationContractparams dorequired(:item).filled(type?: CustomField::Hierarchy::Item)diff --git a/app/contracts/dry_application_contract.rb b/app/contracts/dry_application_contract.rbnew file mode 100644index 00000000000..1e0aef3d8d2--- /dev/null+++ b/app/contracts/dry_application_contract.rb@@ -0,0 +1,35 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++class DryApplicationContract < Dry::Validation::Contract+ config.messages.backend = :i18n+ config.messages.top_namespace = "op_dry_validation"+ config.messages.load_paths = []+enddiff --git a/app/contracts/work_package_types/copy_workflow_attribute_contract.rb b/app/contracts/work_package_types/copy_workflow_attribute_contract.rbindex 515d7e1fa04..547552e8977 100644--- a/app/contracts/work_package_types/copy_workflow_attribute_contract.rb+++ b/app/contracts/work_package_types/copy_workflow_attribute_contract.rb@@ -29,9 +29,7 @@#++module WorkPackageTypes- class CopyWorkflowAttributeContract < Dry::Validation::Contract- config.messages.backend = :i18n-+ class CopyWorkflowAttributeContract < DryApplicationContractparams dooptional(:copy_workflow_from).filled(:string)enddiff --git a/app/models/work_package_types/patterns/collection_contract.rb b/app/models/work_package_types/patterns/collection_contract.rbindex c518694360b..8cd5363a30a 100644--- a/app/models/work_package_types/patterns/collection_contract.rb+++ b/app/models/work_package_types/patterns/collection_contract.rb@@ -30,9 +30,7 @@module WorkPackageTypesmodule Patterns- class CollectionContract < Dry::Validation::Contract- config.messages.backend = :i18n-+ class CollectionContract < DryApplicationContractparams dooptional(:subject).hash dorequired(:blueprint).filled(:string)diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 220772dbc75..b1326f7f1c5 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -364,14 +364,23 @@ en:concatenation:single: "or"- dry_validation:+ op_dry_validation:+ or: "or"errors:- defined: "must not be defined."- int?: "must be an integer."+ array?: "must be an array."decimal?: "must be a decimal."+ defined: "must not be defined."+ eql?: "must be equal to %{left}."filled?: "must be filled."- key?: "is missing."greater_or_equal_zero: "must be greater or equal to 0."+ gteq?: "must be greater than or equal to %{num}."+ hash?: "must be a hash."+ included_in?:+ arg:+ default: "must be one of: %{list}."+ range: "must be one of: %{list_left} - %{list_right}."+ int?: "must be an integer."+ key?: "is missing."not_found: "not found."rules:copy_workflow_from:@@ -387,6 +396,8 @@ en:not_unique: "must be unique within the same hierarchy level."parent:not_descendant: "must be a descendant of the hierarchy root."+ str?: "must be a string."+ type?: "must be %{type}."rules:copy_workflow_from: "Type for workflow copy"enabled: "Enabled"diff --git a/lib/api/v3/custom_fields/hierarchy/get_items_parameter_contract.rb b/lib/api/v3/custom_fields/hierarchy/get_items_parameter_contract.rbindex 85a3902643c..7ea446ca30d 100644--- a/lib/api/v3/custom_fields/hierarchy/get_items_parameter_contract.rb+++ b/lib/api/v3/custom_fields/hierarchy/get_items_parameter_contract.rb@@ -32,12 +32,7 @@ module APImodule V3module CustomFieldsmodule Hierarchy- class GetItemsParameterContract < Dry::Validation::Contract- config.messages.backend = :i18n-- # ToDo: https://community.openproject.org/projects/openproject/work_packages/59238/activity- config.messages.load_paths << "config/locales/en.yml"-+ class GetItemsParameterContract < DryApplicationContractoption :hierarchy_rootparams dodiff --git a/modules/openid_connect/app/services/openid_connect/providers/update_service.rb b/modules/openid_connect/app/services/openid_connect/providers/update_service.rbindex 4c1d4e65d79..9bd67db3c9e 100644--- a/modules/openid_connect/app/services/openid_connect/providers/update_service.rb+++ b/modules/openid_connect/app/services/openid_connect/providers/update_service.rb@@ -31,7 +31,7 @@module OpenIDConnectmodule Providersclass UpdateService < BaseServices::Update- class AttributesContract < Dry::Validation::Contract+ class AttributesContract < DryApplicationContractjson doOpenIDConnect::Provider::DISCOVERABLE_STRING_ATTRIBUTES_MANDATORY.each do |attribute|required(attribute).filled(:string)diff --git a/modules/storages/app/common/storages/adapters/input/add_user_to_group_contract.rb b/modules/storages/app/common/storages/adapters/input/add_user_to_group_contract.rbindex f3a9b7b9bff..0c1deefc7ae 100644--- a/modules/storages/app/common/storages/adapters/input/add_user_to_group_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/add_user_to_group_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class AddUserToGroupContract < Dry::Validation::Contract+ class AddUserToGroupContract < DryApplicationContractparams dorequired(:user).filled(:string)required(:group).filled(:string)diff --git a/modules/storages/app/common/storages/adapters/input/copy_template_folder_contract.rb b/modules/storages/app/common/storages/adapters/input/copy_template_folder_contract.rbindex 591110281fa..9857e06f2d7 100644--- a/modules/storages/app/common/storages/adapters/input/copy_template_folder_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/copy_template_folder_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class CopyTemplateFolderContract < Dry::Validation::Contract+ class CopyTemplateFolderContract < DryApplicationContractparams dorequired(:source).filled(:string)required(:destination).filled(:string)diff --git a/modules/storages/app/common/storages/adapters/input/create_folder_contract.rb b/modules/storages/app/common/storages/adapters/input/create_folder_contract.rbindex 2e636ec955e..fa9e23865d0 100644--- a/modules/storages/app/common/storages/adapters/input/create_folder_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/create_folder_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class CreateFolderContract < Dry::Validation::Contract+ class CreateFolderContract < DryApplicationContractparams dorequired(:folder_name).filled(:string)required(:parent_location).filter(:filled?, :str?).value(AdapterTypes::Location)diff --git a/modules/storages/app/common/storages/adapters/input/delete_folder_contract.rb b/modules/storages/app/common/storages/adapters/input/delete_folder_contract.rbindex 11dff8c46bf..e76d16fd436 100644--- a/modules/storages/app/common/storages/adapters/input/delete_folder_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/delete_folder_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class DeleteFolderContract < Dry::Validation::Contract+ class DeleteFolderContract < DryApplicationContractparams do# FIXME: Should this be a Location?required(:location).filled(:string)diff --git a/modules/storages/app/common/storages/adapters/input/download_link_contract.rb b/modules/storages/app/common/storages/adapters/input/download_link_contract.rbindex f0d0531a1f4..8b3a35bef78 100644--- a/modules/storages/app/common/storages/adapters/input/download_link_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/download_link_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class DownloadLinkContract < Dry::Validation::Contract+ class DownloadLinkContract < DryApplicationContractparams dorequired(:file_link).filled(type?: FileLink)enddiff --git a/modules/storages/app/common/storages/adapters/input/file_info_contract.rb b/modules/storages/app/common/storages/adapters/input/file_info_contract.rbindex e0b3bb554d0..b2244ed6a0f 100644--- a/modules/storages/app/common/storages/adapters/input/file_info_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/file_info_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class FileInfoContract < Dry::Validation::Contract+ class FileInfoContract < DryApplicationContractparams dorequired(:file_id).filled(:string)enddiff --git a/modules/storages/app/common/storages/adapters/input/file_path_to_id_map_contract.rb b/modules/storages/app/common/storages/adapters/input/file_path_to_id_map_contract.rbindex 55d239e3f38..d7c612b8d22 100644--- a/modules/storages/app/common/storages/adapters/input/file_path_to_id_map_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/file_path_to_id_map_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class FilePathToIdMapContract < Dry::Validation::Contract+ class FilePathToIdMapContract < DryApplicationContractparams dorequired(:folder).filter(:filled?, :str?).value(AdapterTypes::Location)required(:depth).filled { (int? & gteq?(0)) | eql?(Float::INFINITY) }diff --git a/modules/storages/app/common/storages/adapters/input/files_contract.rb b/modules/storages/app/common/storages/adapters/input/files_contract.rbindex d6d971c64d4..3f6f86ed88f 100644--- a/modules/storages/app/common/storages/adapters/input/files_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/files_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class FilesContract < Dry::Validation::Contract+ class FilesContract < DryApplicationContractparams dorequired(:folder).filter(:filled?, :str?).value(AdapterTypes::Location)enddiff --git a/modules/storages/app/common/storages/adapters/input/files_info_contract.rb b/modules/storages/app/common/storages/adapters/input/files_info_contract.rbindex d0e3615f996..aa6f6ad4582 100644--- a/modules/storages/app/common/storages/adapters/input/files_info_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/files_info_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class FilesInfoContract < Dry::Validation::Contract+ class FilesInfoContract < DryApplicationContractparams dorequired(:file_ids).array(:string)enddiff --git a/modules/storages/app/common/storages/adapters/input/group_users_contract.rb b/modules/storages/app/common/storages/adapters/input/group_users_contract.rbindex 8caf6f6860f..cc8103b70fe 100644--- a/modules/storages/app/common/storages/adapters/input/group_users_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/group_users_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class GroupUsersContract < Dry::Validation::Contract+ class GroupUsersContract < DryApplicationContractparams dorequired(:group).filled(:string)enddiff --git a/modules/storages/app/common/storages/adapters/input/open_file_link_contract.rb b/modules/storages/app/common/storages/adapters/input/open_file_link_contract.rbindex 904bc5e3701..95cf7293d39 100644--- a/modules/storages/app/common/storages/adapters/input/open_file_link_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/open_file_link_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class OpenFileLinkContract < Dry::Validation::Contract+ class OpenFileLinkContract < DryApplicationContractparams dorequired(:file_id).filled(:string)required(:open_location).maybe(:bool)diff --git a/modules/storages/app/common/storages/adapters/input/remove_user_from_group_contract.rb b/modules/storages/app/common/storages/adapters/input/remove_user_from_group_contract.rbindex 8ee629eaeb3..0b518cadfff 100644--- a/modules/storages/app/common/storages/adapters/input/remove_user_from_group_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/remove_user_from_group_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class RemoveUserFromGroupContract < Dry::Validation::Contract+ class RemoveUserFromGroupContract < DryApplicationContractparams dorequired(:user).filled(:string)required(:group).filled(:string)diff --git a/modules/storages/app/common/storages/adapters/input/rename_file_contract.rb b/modules/storages/app/common/storages/adapters/input/rename_file_contract.rbindex 23dc724d91a..6d517edcb94 100644--- a/modules/storages/app/common/storages/adapters/input/rename_file_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/rename_file_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class RenameFileContract < Dry::Validation::Contract+ class RenameFileContract < DryApplicationContractparams dorequired(:new_name).filled(:string)required(:location).filter(:filled?, :str?).value(AdapterTypes::Location)diff --git a/modules/storages/app/common/storages/adapters/input/set_permissions_contract.rb b/modules/storages/app/common/storages/adapters/input/set_permissions_contract.rbindex d101b3335cd..7e9a0342199 100644--- a/modules/storages/app/common/storages/adapters/input/set_permissions_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/set_permissions_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class SetPermissionsContract < Dry::Validation::Contract+ class SetPermissionsContract < DryApplicationContractparams dorequired(:file_id).filled(:string)required(:user_permissions).array(:hash) dodiff --git a/modules/storages/app/common/storages/adapters/input/strategy_contract.rb b/modules/storages/app/common/storages/adapters/input/strategy_contract.rbindex 9b7149660b0..59931415bf2 100644--- a/modules/storages/app/common/storages/adapters/input/strategy_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/strategy_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class StrategyContract < Dry::Validation::Contract+ class StrategyContract < DryApplicationContractAUTH_METHODS = %i[noop basic_auth oauth_client_credentials oauth_user_token sso_user_token bearer_token].to_set.freezeparams dodiff --git a/modules/storages/app/common/storages/adapters/input/upload_link_contract.rb b/modules/storages/app/common/storages/adapters/input/upload_link_contract.rbindex 54763be553b..4b99018ce6b 100644--- a/modules/storages/app/common/storages/adapters/input/upload_link_contract.rb+++ b/modules/storages/app/common/storages/adapters/input/upload_link_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Input- class UploadLinkContract < Dry::Validation::Contract+ class UploadLinkContract < DryApplicationContractparams dorequired(:folder_id).filled(:string)required(:file_name).filled(:string)diff --git a/modules/storages/app/common/storages/adapters/providers/nextcloud/provider_results/capabilities_contract.rb b/modules/storages/app/common/storages/adapters/providers/nextcloud/provider_results/capabilities_contract.rbindex 7538503b3dd..50627f1c73c 100644--- a/modules/storages/app/common/storages/adapters/providers/nextcloud/provider_results/capabilities_contract.rb+++ b/modules/storages/app/common/storages/adapters/providers/nextcloud/provider_results/capabilities_contract.rb@@ -33,7 +33,7 @@ module Storagesmodule Providersmodule Nextcloudmodule ProviderResults- class CapabilitiesContract < Dry::Validation::Contract+ class CapabilitiesContract < DryApplicationContractparams dorequired(:app_enabled).filled(:bool)required(:group_folder_enabled).filled(:bool)diff --git a/modules/storages/app/common/storages/adapters/results/storage_file_collection_contract.rb b/modules/storages/app/common/storages/adapters/results/storage_file_collection_contract.rbindex 3eed6200bfb..16189841ca4 100644--- a/modules/storages/app/common/storages/adapters/results/storage_file_collection_contract.rb+++ b/modules/storages/app/common/storages/adapters/results/storage_file_collection_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Results- class StorageFileCollectionContract < Dry::Validation::Contract+ class StorageFileCollectionContract < DryApplicationContractparams dorequired(:files).array(AdapterTypes::StorageFileInstance)required(:parent).filled(AdapterTypes::StorageFileInstance)diff --git a/modules/storages/app/common/storages/adapters/results/storage_file_contract.rb b/modules/storages/app/common/storages/adapters/results/storage_file_contract.rbindex 299c8700cc7..cd6a11fd0d7 100644--- a/modules/storages/app/common/storages/adapters/results/storage_file_contract.rb+++ b/modules/storages/app/common/storages/adapters/results/storage_file_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Results- class StorageFileContract < Dry::Validation::Contract+ class StorageFileContract < DryApplicationContractparams dobefore(:value_coercer) do |input|input.to_h.compactdiff --git a/modules/storages/app/common/storages/adapters/results/storage_file_info_contract.rb b/modules/storages/app/common/storages/adapters/results/storage_file_info_contract.rbindex 88085033bc7..63d7dd391b1 100644--- a/modules/storages/app/common/storages/adapters/results/storage_file_info_contract.rb+++ b/modules/storages/app/common/storages/adapters/results/storage_file_info_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Results- class StorageFileInfoContract < Dry::Validation::Contract+ class StorageFileInfoContract < DryApplicationContractparams(StorageFileContract.schema) dobefore(:value_coercer) do |input|input.to_h.compactdiff --git a/modules/storages/app/common/storages/adapters/results/upload_link_contract.rb b/modules/storages/app/common/storages/adapters/results/upload_link_contract.rbindex 778e9a89601..f8716ab8cea 100644--- a/modules/storages/app/common/storages/adapters/results/upload_link_contract.rb+++ b/modules/storages/app/common/storages/adapters/results/upload_link_contract.rb@@ -31,7 +31,7 @@module Storagesmodule Adaptersmodule Results- class UploadLinkContract < Dry::Validation::Contract+ class UploadLinkContract < DryApplicationContractparams dorequired(:destination).filled { uri?(:https) }required(:method).filled(AdapterTypes::HTTPVerb)diff --git a/modules/storages/lib/open_project/storages/engine.rb b/modules/storages/lib/open_project/storages/engine.rbindex fbcaab475ae..5467de31e52 100644--- a/modules/storages/lib/open_project/storages/engine.rb+++ b/modules/storages/lib/open_project/storages/engine.rb@@ -32,7 +32,6 @@# This file got generated by the open_project:plugin generator.# It is loaded by `modules/storages/lib/open_project/storages.rb` when the plugin# gets loaded.-require "dry/validation"Dry::Validation.load_extensions(:monads)diff --git a/spec/contracts/custom_fields/hierarchy/insert_list_item_contract_spec.rb b/spec/contracts/custom_fields/hierarchy/insert_list_item_contract_spec.rbindex 2f94324e40e..fad946b3584 100644--- a/spec/contracts/custom_fields/hierarchy/insert_list_item_contract_spec.rb+++ b/spec/contracts/custom_fields/hierarchy/insert_list_item_contract_spec.rb@@ -53,7 +53,7 @@ RSpec.describe CustomFields::Hierarchy::InsertListItemContract doit "is invalid" doresult = subject.call(params)expect(result).to be_failure- expect(result.errors.to_h).to include(parent: ["must be CustomField::Hierarchy::Item"])+ expect(result.errors.to_h).to include(parent: ["must be CustomField::Hierarchy::Item."])endend@@ -67,7 +67,7 @@ RSpec.describe CustomFields::Hierarchy::InsertListItemContract doit "is invalid" doresult = subject.call(params)expect(result).to be_failure- expect(result.errors.to_h).to include(label: [I18n.t("dry_validation.errors.rules.label.not_unique")])+ expect(result.errors.to_h).to include(label: ["must be unique within the same hierarchy level."])endcontext "if another locale is set" do@@ -77,7 +77,7 @@ RSpec.describe CustomFields::Hierarchy::InsertListItemContract doI18n.config.enforce_available_locales = falseI18n.backend.store_translations(:mo,- { dry_validation: {+ { op_dry_validation: {errors: { rules: { label: { not_unique: mordor } } }} })@@ -105,7 +105,7 @@ RSpec.describe CustomFields::Hierarchy::InsertListItemContract doit "is invalid with localized validation errors" doresult = subject.call(params)expect(result).to be_failure- expect(result.errors.to_h).to include(short: [I18n.t("dry_validation.errors.rules.short.not_unique")])+ expect(result.errors.to_h).to include(short: ["must be unique within the same hierarchy level."])endend@@ -124,7 +124,7 @@ RSpec.describe CustomFields::Hierarchy::InsertListItemContract doit "is invalid" doresult = subject.call(params)expect(result).to be_failure- expect(result.errors.to_h).to include(short: [I18n.t("dry_validation.errors.str?")])+ expect(result.errors.to_h).to include(short: ["must be a string."])endenddiff --git a/spec/contracts/custom_fields/hierarchy/insert_scored_item_contract_spec.rb b/spec/contracts/custom_fields/hierarchy/insert_scored_item_contract_spec.rbindex 6c0f5e26f07..175bc3c5829 100644--- a/spec/contracts/custom_fields/hierarchy/insert_scored_item_contract_spec.rb+++ b/spec/contracts/custom_fields/hierarchy/insert_scored_item_contract_spec.rb@@ -46,9 +46,7 @@ RSpec.describe CustomFields::Hierarchy::InsertScoredItemContract doendend- context "when inputs are empty",- skip: "dry validation custom locales are not loaded correctly when running this spec together " \- "with others from this folder." do+ context "when inputs are empty" dolet(:params) { { parent:, label: "", score: "" } }it "is invalid" do@@ -59,9 +57,7 @@ RSpec.describe CustomFields::Hierarchy::InsertScoredItemContract doendend- context "when inputs are missing",- skip: "dry validation custom locales are not loaded correctly when running this spec together " \- "with others from this folder." do+ context "when inputs are missing" dolet(:params) { { parent: } }it "is invalid" do@@ -79,7 +75,7 @@ RSpec.describe CustomFields::Hierarchy::InsertScoredItemContract doit "is invalid" doresult = subject.call(params)expect(result).to be_failure- expect(result.errors.to_h).to include(parent: ["must be CustomField::Hierarchy::Item"])+ expect(result.errors.to_h).to include(parent: ["must be CustomField::Hierarchy::Item."])endend@@ -91,7 +87,7 @@ RSpec.describe CustomFields::Hierarchy::InsertScoredItemContract doit "is invalid" doresult = subject.call(params)expect(result).to be_failure- expect(result.errors.to_h).to include(label: [I18n.t("dry_validation.errors.rules.label.not_unique")])+ expect(result.errors.to_h).to include(label: ["must be unique within the same hierarchy level."])endcontext "if another locale is set" do@@ -101,7 +97,7 @@ RSpec.describe CustomFields::Hierarchy::InsertScoredItemContract doI18n.config.enforce_available_locales = falseI18n.backend.store_translations(:mo,- { dry_validation: {+ { op_dry_validation: {errors: { rules: { label: { not_unique: mordor } } }} })@@ -127,7 +123,7 @@ RSpec.describe CustomFields::Hierarchy::InsertScoredItemContract doit "is invalid with localized validation errors" doresult = subject.call(params)expect(result).to be_failure- expect(result.errors.to_h).to include(score: [I18n.t("dry_validation.errors.decimal?")])+ expect(result.errors.to_h).to include(score: ["must be a decimal."])endenddiff --git a/spec/contracts/custom_fields/hierarchy/update_list_item_contract_spec.rb b/spec/contracts/custom_fields/hierarchy/update_list_item_contract_spec.rbindex cc8f5b8a3f4..44e1094f49c 100644--- a/spec/contracts/custom_fields/hierarchy/update_list_item_contract_spec.rb+++ b/spec/contracts/custom_fields/hierarchy/update_list_item_contract_spec.rb@@ -70,7 +70,7 @@ RSpec.describe CustomFields::Hierarchy::UpdateListItemContract doit("is invalid") doresult = subject.call(params)expect(result).to be_failure- expect(result.errors.to_h).to include(item: ["must be CustomField::Hierarchy::Item"])+ expect(result.errors.to_h).to include(item: ["must be CustomField::Hierarchy::Item."])endenddiff --git a/spec/contracts/custom_fields/hierarchy/update_scored_item_contract_spec.rb b/spec/contracts/custom_fields/hierarchy/update_scored_item_contract_spec.rbindex 44c1741b9d0..8e4853078d4 100644--- a/spec/contracts/custom_fields/hierarchy/update_scored_item_contract_spec.rb+++ b/spec/contracts/custom_fields/hierarchy/update_scored_item_contract_spec.rb@@ -69,7 +69,7 @@ RSpec.describe CustomFields::Hierarchy::UpdateScoredItemContract doit("is invalid") doresult = subject.call(params)expect(result).to be_failure- expect(result.errors.to_h).to include(item: ["must be CustomField::Hierarchy::Item"])+ expect(result.errors.to_h).to include(item: ["must be CustomField::Hierarchy::Item."])endenddiff --git a/spec/requests/api/v3/custom_fields/hierarchy/items_api_spec.rb b/spec/requests/api/v3/custom_fields/hierarchy/items_api_spec.rbindex 76719237e79..4907ef5557b 100644--- a/spec/requests/api/v3/custom_fields/hierarchy/items_api_spec.rb+++ b/spec/requests/api/v3/custom_fields/hierarchy/items_api_spec.rb@@ -84,13 +84,13 @@ RSpec.describe "API v3 custom field hierarchy items", :webmock, content_type: :jcontext "if parent is set to an undefined value" dolet(:path) { api_v3_paths.custom_field_items(custom_field.id, "wrong item") }- it_behaves_like "error response", 400, "InvalidQuery", "Parent #{I18n.t('dry_validation.errors.int?')}"+ it_behaves_like "error response", 400, "InvalidQuery", "Parent must be an integer."endcontext "if depth is negative" dolet(:path) { api_v3_paths.custom_field_items(custom_field.id, nil, -1) }- it_behaves_like "error response", 400, "InvalidQuery", "Depth #{I18n.t('dry_validation.errors.greater_or_equal_zero')}"+ it_behaves_like "error response", 400, "InvalidQuery", "Depth must be greater or equal to 0."endendenddiff --git a/spec/services/work_package_types/set_attributes_service_spec.rb b/spec/services/work_package_types/set_attributes_service_spec.rbindex 28cc56da6ff..764eb152913 100644--- a/spec/services/work_package_types/set_attributes_service_spec.rb+++ b/spec/services/work_package_types/set_attributes_service_spec.rb@@ -68,7 +68,7 @@ module WorkPackageTypesit "adds an error on the patterns attribute" doresult = service.call(params)- expect(result.errors.details).to eq(patterns: [{ error: "Enabled is missing" }])+ expect(result.errors.details).to eq(patterns: [{ error: "Enabled is missing." }])endit "does not override the already existing value on the model" do