MediaTypeDsl

interface MediaTypeDsl

DSL for media type objects(https://spec.openapis.org/oas/v3.1.0#media-type-object

  • This DSL has extensions that allow to easily define schemas from KType objects (including types of arbitrary

  • classes).

Functions

Link copied to clipboard
abstract fun schema(ktype: KType)

Sets the schema of this object to be of the given KType. The type will be converted to a schema.

Properties

Link copied to clipboard
abstract var example: Any?

The example for this object. Should match the given schema.

Link copied to clipboard
abstract var schema: Schema<*>?

The schema for this object.

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
inline fun <T> MediaTypeDsl.schema()

Set the schema to be of type T.

inline fun <T> MediaTypeDsl.schema(example: T)

Set the schema to be of type T, with the given object set as the example.

fun <T> MediaTypeDsl.schema(ktype: KType, example: T)

Set the schema to be of type ktype, with the given object set as the example.