Top Description Methods
org.eclipse.microprofile.openapi.models.media

public Interface Discriminator

extends Constructible
Imports
java.util.Map, org.eclipse.microprofile.openapi.models.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

Modifier and TypeMethod and Description
public Discriminator

Returns:

the current Discriminator instance
addMapping
(String
a key which will be compared to information from a request body or response payload.
name
,
String
a schema name or reference. null values will be rejected (implementation will throw an exception) or ignored.
value
)

Maps the given name to the given value and stores it in this Discriminator's mapping property.

public Map<String, String>

Returns:

a copy Map (potentially immutable) containing keys and schema names or references
getMapping
()

Returns the mapping property from a Discriminator instance.

public String

Returns:

the name of the property in the payload that will hold the discriminator value
getPropertyName
()

Returns the propertyName property from a Discriminator instance.

public default Discriminator

Returns:

the current Discriminator instance
mapping
(Map<String, String>
a map containing keys and schema names or references
mapping
)

Sets this Discriminator's mapping property to the given map object.

public default Discriminator

Returns:

the current Discriminator instance
propertyName
(String
the name of the property in the payload that will hold the discriminator value
propertyName
)

Sets this Discriminator's propertyName property to the given string.

public void
removeMapping(String
a key which will be compared to information from a request body or response payload.
name
)

Remove the given name to the given value and stores it in this Discriminator's mapping property.

public void
setMapping(Map<String, String>
a map containing keys and schema names or references
mapping
)

Sets this Discriminator's mapping property to the given map object.

public void
setPropertyName(String
the name of the property in the payload that will hold the discriminator value
propertyName
)

Sets this Discriminator's propertyName property to the given propertyName.

Method Detail

addMappingback to summary
public Discriminator addMapping(String name, String value)

Maps the given name to the given value and stores it in this Discriminator's mapping property.

Parameters
name:String

a key which will be compared to information from a request body or response payload.

value:String

a schema name or reference. null values will be rejected (implementation will throw an exception) or ignored.

Returns:Discriminator

the current Discriminator instance

getMappingback to summary
public Map<String, String> getMapping()

Returns the mapping property from a Discriminator instance.

Returns:Map<String, String>

a copy Map (potentially immutable) containing keys and schema names or references

getPropertyNameback to summary
public String getPropertyName()

Returns the propertyName property from a Discriminator instance.

Returns:String

the name of the property in the payload that will hold the discriminator value

mappingback to summary
public default Discriminator mapping(Map<String, String> mapping)

Sets this Discriminator's mapping property to the given map object.

Parameters
mapping:Map<String, String>

a map containing keys and schema names or references

Returns:Discriminator

the current Discriminator instance

propertyNameback to summary
public default Discriminator propertyName(String propertyName)

Sets this Discriminator's propertyName property to the given string.

Parameters
propertyName:String

the name of the property in the payload that will hold the discriminator value

Returns:Discriminator

the current Discriminator instance

removeMappingback to summary
public void removeMapping(String name)

Remove the given name to the given value and stores it in this Discriminator's mapping property.

Parameters
name:String

a key which will be compared to information from a request body or response payload.

setMappingback to summary
public void setMapping(Map<String, String> mapping)

Sets this Discriminator's mapping property to the given map object.

Parameters
mapping:Map<String, String>

a map containing keys and schema names or references

setPropertyNameback to summary
public void setPropertyName(String propertyName)

Sets this Discriminator's propertyName property to the given propertyName.

Parameters
propertyName:String

the name of the property in the payload that will hold the discriminator value