athena v0.9.0 Release Notes
Release Date: 2020-06-10 // almost 4 years ago-
๐ This release focuses on refining the foundational concepts of Athena as well as some QoL improvements and bug fixes along the way. See the linked sections in the API documentation for more details/examples.
โฌ๏ธ Dependency Upgrades
- ๐ https://github.com/crystal-ameba/ameba/releases/tag/v0.12.0
- ๐ https://github.com/athena-framework/dependency-injection/releases/tag/v0.2.0
โ Additions
- โ Add
NotImplemented
andBadGateway
exception classes - ๐ Allow layouts to be used with ECR (#52)
- Introduce concept of ART::Response::Writer to control how the response content is written to the response IO
- By default it is written directly, but can be changed to enable compression for example
- ๐ฒ Implement logging based on the new
Log
module- Logs matched routes are logged with the route, method, and path/query arguments via the
RoutingListener
- Logs any exceptions that happen via the
ErrorListener
- Logs matched routes are logged with the route, method, and path/query arguments via the
- Introduce concept of Arguments::Resolvers::ArgumentValueResolverInterface
- Handle resolving the arguments for a controller action from a request, or other source.
- Introduce route collision detection
- A compile time error is raised if two routes share the same path; either statically, or with path arguments in the same locations.
- โ Add a built in ART::TimeConverter that converts a date(time) string into a Time instance
๐ Changes
- ๐จ Refactor
ART::Response
to allow writing directly to the response IO- Use ART::Response.new with a block
- (breaking-change) Change
ART::Exceptions::HTTPException
order- Makes
message
required and first
- Makes
- (breaking-change) Updates for the new Athena::DependencyInjection version
include ADI::Service
is no longer required within custom listeners- Arguments are now resolved automatically
- See the DI changelog for more details
- Manually defines initializers for child
HTTPException
types- Makes it easier to extend non
ART::Exceptions::HTTPException
s for custom exception types
- Makes it easier to extend non
- (breaking-change) Changed the implementation of
HTTP::Request#attributes
monkey patch to use ART::ParameterBag- The parameter bag is more flexible, allowing the storage of arbitrary data, not restricted to the union of the hash
- An optional type can be provided when setting a value to get type safety on the value
- (breaking-change) Refactored how ART::ParamConverterInterface work
- Param converters no longer return the converted value
- It should most commonly be stored within the request's
ART::ParameterBag
- An additional ART::ParamConverterInterface::ConfigurationInterface argument is also provided to support variable configuration on a per converter basis
- Param converters are now services and can now use other services as dependencies
Removals
- (breaking-change) Removed
HTTP::Request#path_params
monkey-patch- This data is now stored within the the request's
ART::ParameterBag
- This data is now stored within the the request's
- (breaking-change) The
ADI::Injectable
module is now removed in favor of directly registering controllers as services in order to use other service dependencies- Allows making use of more advanced DI features
- Controllers MUST be declared as public services, e.x.
@[ADI::Register(public: true)]
- A compile time error is raised if they are not
- (breaking-change) Removed the
ssl
option fromART.run
- Would be better to have
nginx
, or something similar, sitting in front of the server - Could be reimplemented in the future if so desired
- Would be better to have
๐ Fixes
- Correctly return a
405
if the route exists but not for the used HTTP method - ๐ Use
HTTP::Headers#[]=
versus#add
to avoid creating an array of the same header - ๐ Use correct
#to_json
overload forART::Exceptions::HTTPException