annotation Athena::Routing::QueryParam
Overview
Defines a query parameter tied to a given argument.
The type of the query param is derived from the type restriction of the associated controller action argument.
A non-nilable type denotes it as required. If the parameter is not supplied, and no default value is assigned, an ART::Exceptions::BadRequest exception is raised.
A nilable type denotes it as optional. If the parameter is not supplied (or could not be converted), and no default value is assigned, it is nil.
Fields
- name :
String- The name of the query parameter, may also be provided as the first positional argument. - constraints :
Regex- A pattern the query param must match to be considered valid.
Example
@[ART::Get(path: "/example")]
@[ART::QueryParam("query_param")]
def get_user(query_param : String) : Nil
end