Class: Operations::Contract::MessagesResolver

Inherits:
Dry::Validation::Messages::Resolver
  • Object
show all
Defined in:
lib/operations/contract/messages_resolver.rb

Overview

Patching the default messages resolver to append ‘:code` meta to every message produced.

Instance Method Summary collapse

Instance Method Details

#call(message:, meta: Dry::Schema::EMPTY_HASH, **rest) ⇒ Object



6
7
8
9
10
# File 'lib/operations/contract/messages_resolver.rb', line 6

def call(message:, meta: Dry::Schema::EMPTY_HASH, **rest)
  meta = meta.merge(code: message) if message.is_a?(Symbol)

  super
end