Package io.muserver.openapi
Class DiscriminatorObjectBuilder
- java.lang.Object
-
- io.muserver.openapi.DiscriminatorObjectBuilder
-
public class DiscriminatorObjectBuilder extends java.lang.Object
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.When using the discriminator, inline schemas will not be considered.
-
-
Constructor Summary
Constructors Constructor Description DiscriminatorObjectBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DiscriminatorObject
build()
static DiscriminatorObjectBuilder
discriminatorObject()
Creates a builder for aDiscriminatorObject
DiscriminatorObjectBuilder
withMapping(java.util.Map<java.lang.String,java.lang.String> mapping)
DiscriminatorObjectBuilder
withPropertyName(java.lang.String propertyName)
-
-
-
Method Detail
-
withPropertyName
public DiscriminatorObjectBuilder withPropertyName(java.lang.String propertyName)
- Parameters:
propertyName
- REQUIRED. The name of the property in the payload that will hold the discriminator value.- Returns:
- The current builder
-
withMapping
public DiscriminatorObjectBuilder withMapping(java.util.Map<java.lang.String,java.lang.String> mapping)
- Parameters:
mapping
- An object to hold mappings between payload values and schema names or references.- Returns:
- The current builder
-
build
public DiscriminatorObject build()
- Returns:
- A new object
-
discriminatorObject
public static DiscriminatorObjectBuilder discriminatorObject()
Creates a builder for aDiscriminatorObject
- Returns:
- A new builder
-
-