class TestSerializer(serializers.Serializer):
    foo = serializers.CharField()

def validate(self, attrs):
    unknown = set(self.initial_data.keys()) - set(self.fields.keys())
if unknown:
    raise ValidationError('Unknown field(s): {}'.format(', '.join(unknown)))
return attrs
How to make a rest_framework Serializer disallow superfluous fields?