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 Set {"application/atom+xml"}, "css" => Set {"text/css"}, "csv" => Set {"text/csv"}, "form" => Set {"application/x-www-form-urlencoded", "multipart/form-data"}, "html" => Set {"text/html", "application/xhtml+xml"}, "js" => Set {"application/javascript", "application/x-javascript", "text/javascript"}, "json" => Set {"application/json", "application/x-json"}, "jsonld" => Set {"application/ld+json"}, "rdf" => Set {"application/rdf+xml"}, "rss" => Set {"application/rss+xml"}, "txt" => Set {"text/plain"}, "xml" => Set {"text/xml", "application/xml", "application/x-xml"}}" href="../../Request/#Athena::Framework::Request::FORMATS">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.