Skip to content

Roadmap

Nick Sutterer edited this page Oct 21, 2016 · 5 revisions

Operation

result = Operation.(params: params, **)

Model/Contract

Both model and contract are not included per default.

Dependency Injection

Operation supports dependency injection and auto-injection.

result = Operation.(params: params, "policy.create" => Comment::Policy::Create)

auto_inject

Operation supports auto_inject.

class Create < Trailblazer::Operation
  include AutoInject[:user_repository]
end

Result Object

The operation in Trailblazer 1.2 returns a Result object that is compatible with dry-matcher.

result = Operation.(params: params, **)
res = matcher.(result) do |m|
  m.success do |v|
    "Yay: #{v}"
  end

  m.failure :not_found do |v|
    "Oops, not found: #{v}"
  end

  m.failure do |v|
    "Boo: #{v}"
  end
end

Standard Cases are provided.

Endpoint

Endpoints can be hooked to routes in the infrastructure framework (e.g. Rails or Hanami-router). The provide generic logic such as

  • HTTP status/redirect/bodys for document APIs (similar to responders work in Rails).
  • Serialize the outbound document using a configured representer (or serializer).

Goal of endpoints is to have generic handling code that is neither coupled to Trailblazer::Operation nor to a specific infrastructure framework.

Transaction

Operation integrates dry-transaction with a nice slim API for transactions in the operation.

2.0

Deserializtion

Make it possible to separate deserialization and validation. Make deserializer a separate step that builds the virtual object graph, then run arbitrary validations on it.

Clone this wiki locally