Interface Discriminator

  • All Superinterfaces:
    Constructible


    public interface Discriminator
    extends Constructible
    Discriminator

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    See Also:
    OpenAPI Specification Discriminator Object
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Discriminator addMapping​(java.lang.String name, java.lang.String value)
      Maps the given name to the given value and stores it in this Discriminator's mapping property.
      java.util.Map<java.lang.String,java.lang.String> getMapping​()
      Returns the mapping property from a Discriminator instance.
      java.lang.String getPropertyName​()
      Returns the propertyName property from a Discriminator instance.
      Discriminator mapping​(java.util.Map<java.lang.String,java.lang.String> mapping)
      Sets this Discriminator's mapping property to the given map object.
      Discriminator propertyName​(java.lang.String propertyName)
      Sets this Discriminator's propertyName property to the given string.
      void setMapping​(java.util.Map<java.lang.String,java.lang.String> mapping)
      Sets this Discriminator's mapping property to the given map object.
      void setPropertyName​(java.lang.String propertyName)
      Sets this Discriminator's propertyName property to the given propertyName.
    • Method Detail

      • propertyName

        Discriminator propertyName​(java.lang.String propertyName)
        Sets this Discriminator's propertyName property to the given string.
        Parameters:
        propertyName - the name of the property in the payload that will hold the discriminator value
        Returns:
        the current Discriminator instance
      • getPropertyName

        java.lang.String getPropertyName​()
        Returns the propertyName property from a Discriminator instance.
        Returns:
        the name of the property in the payload that will hold the discriminator value
      • setPropertyName

        void setPropertyName​(java.lang.String propertyName)
        Sets this Discriminator's propertyName property to the given propertyName.
        Parameters:
        propertyName - the name of the property in the payload that will hold the discriminator value
      • addMapping

        Discriminator addMapping​(java.lang.String name,
                                 java.lang.String value)
        Maps the given name to the given value and stores it in this Discriminator's mapping property.
        Parameters:
        name - a key which will be compared to information from a request body or response payload.
        value - a schema name or reference
        Returns:
        the current Discriminator instance
      • mapping

        Discriminator mapping​(java.util.Map<java.lang.String,java.lang.String> mapping)
        Sets this Discriminator's mapping property to the given map object.
        Parameters:
        mapping - a map containing keys and schema names or references
        Returns:
        the current Discriminator instance
      • getMapping

        java.util.Map<java.lang.String,java.lang.String> getMapping​()
        Returns the mapping property from a Discriminator instance.
        Returns:
        a map containing keys and schema names or references
      • setMapping

        void setMapping​(java.util.Map<java.lang.String,java.lang.String> mapping)
        Sets this Discriminator's mapping property to the given map object.
        Parameters:
        mapping - a map containing keys and schema names or references