Ruby 如果架构验证未通过,如何防止干式验证执行规则? class PostSchema

Ruby 如果架构验证未通过,如何防止干式验证执行规则? class PostSchema,ruby,dry-validation,Ruby,Dry Validation,我目前的工作是使用result.schema\u result.success?。即使这样也能工作,但我看了一下源代码。它是私有api。有人知道吗?将始终执行没有指定任何键的规则。那是故意的。如果不希望执行,只需提供它所依赖的键,即: rule(:title, :content) do # won't be executed unless both title and content passed # the schema checks end

我目前的工作是使用result.schema\u result.success?。即使这样也能工作,但我看了一下源代码。它是私有api。有人知道吗?

将始终执行没有指定任何键的规则。那是故意的。如果不希望执行,只需提供它所依赖的键,即:

rule(:title, :content) do
  # won't be executed unless both title and content passed
  # the schema checks
end