annotation Athena::Routing::Annotations::View
Overview
Configures how the endpoint should be rendered.
Fields
- status :
HTTP::Status
- TheHTTP::Status
the endpoint should return. Defaults toHTTP::Status::OK
(200). - serialization_groups :
Array(String)?
- The serialization groups to use for this route as part ofASR::ExclusionStrategies::Groups
. - validation_groups :
Array(String)?
- Groups that should be used to validate any objects related to this route; seeAVD::Constraint@validation-groups
. - emit_nil :
Bool
- Ifnil
values should be serialized. Defaults tofalse
.
Example
@[ARTA::Post(path: "/publish/:id")]
@[ARTA::View(status: :accepted, serialization_groups: ["default", "detailed"])]
def publish(id : Int32) : Article
article = Article.find id
article.published = true
article
end
See the external documentation for more information.