Skip to content

annotation Athena::Framework::Annotations::MapRequestBody #

Enables the ATHR::RequestBody resolver for the parameter this annotation is applied to based on the request's body. See the related resolver documentation for more information.

class UserController < ATH::Controller
  @[ARTA::Post("/user")]
  def new_user(
    @[ATHA::MapRequestBody]
    user_create : UserCreateDTO,
  ) : UserCreateDTO
    user_create
  end
end

Configuration#

Optional Arguments#

accept_formats#

Type: Array(String)? Default: nil

Allows whitelisting the allowed request format(s). If the ATH::Request#content_type_format is not included in this list, a ATH::Exception::UnsupportedMediaType error will be raised.

validation_groups#

Type: Array(String) | AVD::Constraints::GroupSequence | Nil Default: nil

The validation groups that should be used when validating the resolved object.