Add type checking and schema compatibility check