Module: Trailblazer::Operation::Representer

Defined in:
lib/trailblazer/operation/representer.rb

Defined Under Namespace

Modules: DSL

Class Method Summary collapse

Class Method Details

.infer(contract_class, format: Representable::JSON) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/trailblazer/operation/representer.rb', line 3

def self.infer(contract_class, format:Representable::JSON)
  Disposable::Rescheme.from(contract_class,
    include:          [format],
    options_from:     :deserializer, # use :instance etc. in deserializer.
    superclass:       Representable::Decorator,
    definitions_from: lambda { |inline| inline.definitions },
    exclude_options:  [:default, :populator], # TODO: test with populator: in an operation.
    exclude_properties: [:persisted?]
  )
end