build schema js function