Refactor the types and test API declarations and models against them