after adding the gem dry-rails to my rails application, I have defined a contract:
module Users
module Contracts
class New < ApplicationContract
params do
required(:todo).schema do
required(:title).filled(:string)
required(:items).array(:hash) do
required(:name).filled(:string)
end
end
end
end
end
end
But I don't know how to make this contract work. Let's say I have a controller named UsersController:
module Api
module V1
class UsersController < ApplicationController
before_action :set_user
private
def set_user
@user = User.find(params[:user_id])
end
end
end
end
how can I make this controller use the contract New to get validation run?