Class: PactBroker::Api::Contracts::WebhookContract

Inherits:
BaseContract
  • Object
show all
Defined in:
lib/pact_broker/api/contracts/webhook_contract.rb

Instance Method Summary collapse

Instance Method Details

#validateObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pact_broker/api/contracts/webhook_contract.rb', line 11

def validate(*)
  result = super
  # I just cannot seem to get the validation to stop on the first error.
  # If one rule fails, they all come back failed, and it's driving me nuts.
  # Why on earth would I want that behaviour?
  new_errors = Reform::Contract::Errors.new
  errors.messages.each do | key, value |
    new_errors.add(key, value.first)
  end
  @errors = new_errors
  result
end