athena-framework / athena

An ecosystem of reusable, independent components
https://athenaframework.org
MIT License
211 stars 17 forks source link

Fix processing of top level configuration annotations applied to controller action parameters #352

Closed Blacksmoke16 closed 7 months ago

Blacksmoke16 commented 7 months ago
ACF.configuration_annotation Test

class ExampleController < ATH::Controller
  @[ARTA::Get("/{id}")]
  def root(@[Test] id : Int64) : String
    "root"
  end
end

ATH.run

Results in:

In src/components/framework/src/ext/routing/annotation_route_loader.cr:204:65

 204 | resolver = parse_type(ann.name.names[0..-2].join "::").resolve
                                                   ^---
Error: argument to parse_type cannot be an empty value

This is because [0..-2] returns an empty array since there is only one name in its path.