ReferenceOr

Defines Union A | Reference. A lot of types like Header, Schema, MediaType, etc. can be either a direct value or a reference to a definition.

Report a problem

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Reference(val ref: String, val isDynamic: Boolean = false) : ReferenceOr<Nothing>

A reference to a definition within the current document.

Link copied to clipboard
value class Value<A>(val value: A) : ReferenceOr<A>

Functions

Link copied to clipboard
open fun <B> mapToReference(mappingFunction: (A) -> ReferenceOr<B>): ReferenceOr<B>

Same as map, but for mapping to references.

Link copied to clipboard
open fun <B> mapValue(mappingFunction: (A) -> B): ReferenceOr<B>

Maps the value using the given function.

Link copied to clipboard
Link copied to clipboard
open fun valueOrNull(): A?

Returns the value if this instance is of type Value, or null if it is of type Reference.