Removed assumption that nested resources have the same ID type as parents; minor cleanup in generation logic