casting attributes according to schema