Dry::Struct attribute alias

Would be nice to be able to define an alias for a given attribute on dry-struct:

class Foo < Dry::Struct
  attribute :id, Types::String, as: :some_alias_name 
end

@gottfrois Given how easy this is to do with Ruby’s built-in alias_method, or something similar, I’m not sure this kind of thing would make its way into the gem. Do you need to alias very often?

Not really, we just needed an easy way to alias this id attribute. Now, using alias_method works fine, it’s just more intuitive to have this at the time you define the attribute rather than couple lines later IMO.

@gottfrois Fair enough. If it’s important for you, you could always make your app’s own struct superclass that inherits from dry-struct and overrides .attribute with support for setting the alias.

dry-struct will never support options, I won’t repeat the same mistake like in Virtus.