Add subclass matching to serializer field mapping.

First attempt at #1809.