Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 818 Bytes

polymorphism.rst

File metadata and controls

27 lines (19 loc) · 818 Bytes

Polymorphism

-- Someone on Stack Overflow

Sometimes data exposed via the API has a different shape, depending on the value of a field that's common to all possible shapes.

This module adds support for polymorphic serializing and deserializing of this data.

You use it by defining a base serializer for the shared fields (at least one, used as discriminator field), and map the values of the discriminator to the additional fields that need to be displayed.

A field inspector is included to output is correctly into an OAS 2.0 schema.

Public API

vng_api_common.polymorphism