Polymorphic Responses with Discriminator Field

Release DateApr 7, 2017
Change Type
Platforms Affected

APIMatic Code Generation engine now supports polymorphic responses with the help of a discriminator field.

  • Discriminator is a field that is used to differentiate between a parent model and models that inherit from it.
  • The response is deserialized into the parent model or one of its child classes by inspecting the discriminator field’s value in the response.
  • Using a discriminator field, you can build leaner models by not having to build unions of fields needed by a polymorphic response.

Check out the Discriminator documentation to get started.

Details

The Discriminator documentation details how to handle polymorphic response in your API.

Also, see the following docs for support in different API description formats:

Related Links


Have questions? Submit a request.