Module: Taro::Rails::ResponseValidation

Defined in:
lib/taro/rails/response_validation.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.install(controller_class:) ⇒ Object



2
3
4
# File 'lib/taro/rails/response_validation.rb', line 2

def self.install(controller_class:)
  controller_class.prepend(self) if Taro.config.validate_response
end

Instance Method Details

#render(**kwargs) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/taro/rails/response_validation.rb', line 6

def render(*, **kwargs, &)
  result = super
  if (declaration = Taro::Rails.declaration_for(self))
    Taro::Rails::ResponseValidator.call(self, declaration, kwargs[:json])
  end
  result
end