Skip to content

Commit

Permalink
Fixes validate! method
Browse files Browse the repository at this point in the history
  • Loading branch information
eliasjpr committed Aug 10, 2020
1 parent e3240b1 commit e2bb39b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/schema/validation.cr
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module Schema
end

def validate!
valid? || raise Schema::Error.new(errors)
valid? || raise errors.messages.join ","
end

def errors
Expand All @@ -79,7 +79,7 @@ module Schema
rules << Schema::Rule.new(:{{name.id}}, {{options[:message]}} || "") do |rule|
{% for predicate, expected_value in options %}
{% custom_validator = predicate.id.stringify.split('_').map(&.capitalize).join("") + "Validator" %}
{% if !["message", "type", "inner", "nilable"].includes?(predicate.stringify) && CUSTOM_VALIDATORS[custom_validator] == nil %}
{% if !["message", "param_type", "type", "inner", "nilable"].includes?(predicate.stringify) && CUSTOM_VALIDATORS[custom_validator] == nil %}
rule.{{predicate.id}}?(@{{name.id}}, {{expected_value}}) &
{% end %}
{% end %}
Expand Down

0 comments on commit e2bb39b

Please sign in to comment.