Module: Trailblazer::V1_1::Operation::Representer::Deserializer::JSON
- Included in:
- Trailblazer::V1_1::Operation::Representer
- Defined in:
- lib/trailblazer/1.1/operation/representer.rb
Overview
This looks crazy, but all it does is using a Reform hook in #validate where we can use our own representer for deserialization. After the object graph is set up, Reform will run its validation without even knowing this came from JSON.
Instance Method Summary collapse
Instance Method Details
#validate_contract(params) ⇒ Object
90 91 92 93 94 |
# File 'lib/trailblazer/1.1/operation/representer.rb', line 90 def validate_contract(params) contract.validate(params) do |document| self.class.representer_class.new(contract).from_json(document) end end |