Skip to content
Matt Muller edited this page Oct 5, 2021 · 6 revisions

Params are modules that convert user provided input into rigid shapes used by middleware. Params have a 1:1 mapping to Smithy shapes.

Param modules will initialize Types and set members if they exist. Params will do lightweight validation (using Seahorse::Validator) for aggregate structures, such as Array, Hash, and Set, so that values can be iterated over.

module SampleService
  module Params

    module HighScoreParams
      def self.build(params, context: '')
        Seahorse::Validator.validate!(params, Hash, Types::HighScoreParams, context: context)
        type = Types::HighScoreParams.new
        type.game = params[:game]
        type.score = params[:score]
        type
      end
    end

  end
end