If I’m not wrong, it is not possible to create an alias for a relation attribute without having to redefine its writer type, too:
schema(:users, infer: true) do attribute :act, Type::Strict::Bool.meta(alias: :active) end
In the previous example all attributes of
:users relation are inferred, except for the need to rename
:active which forces me to redefine its type.
I think it is an unnecessary coupling. I don’t see the name given to an attribute as something related to its type. I think type information should be related just with the attribute value. It is weird, it is like saying that a variable type depends on the name you give to this variable. I think there is a smell in the fact that the reader type, even if it isn’t defined, will use the same aliased name.
It would be really useful for legacy schemas, where you want to rename attributes but still rely on the automatic inferring of types.
What do you think?