Add validation and conversion to the `attributes` argument