DebugBodyParams

Declares the fields of a route's request body (DebugRoute.body): the members of a JSON object, or the fields of a form when DebugRoute.acceptsForm is on.

Functions

Link copied to clipboard
fun boolean(name: String, declare: DebugParamSpec.() -> Unit = {}): DebugParam<Boolean?>

Declares a parameter named name that is true or false.

Link copied to clipboard
fun double(name: String, declare: DebugNumberSpec.() -> Unit = {}): DebugParam<Double?>

Declares a decimal parameter named name, such as 0.35 or 1e-3, as a Double, in the range of DebugNumberSpec.min and DebugNumberSpec.max when they are set. A whole number, such as 2, is a decimal too. NaN, the infinities, and a number too large for a Double get a 400: JSON can't carry them. In the query or a form, the value is written as a JSON number, optionally with a leading +, so 0x1p3 and 1d get a 400.

Link copied to clipboard
fun int(name: String, declare: DebugIntegerSpec.() -> Unit = {}): DebugParam<Int?>

Declares a whole-number parameter named name, from Int.MIN_VALUE to Int.MAX_VALUE unless DebugIntegerSpec.min and DebugIntegerSpec.max narrow it.

Link copied to clipboard
fun json(name: String, declare: DebugParamSpec.() -> Unit = {}): DebugParam<String?>

Declares a field named name that takes any JSON value. The handler gets the value as JSON text, such as ["a","b"] or "text", and parses it itself. Set DebugParamSpec.schema to describe the value in the OpenAPI document.

Link copied to clipboard
fun long(name: String, declare: DebugIntegerSpec.() -> Unit = {}): DebugParam<Long?>

Declares a whole-number parameter named name, as a Long.

Link copied to clipboard
fun string(name: String, declare: DebugStringSpec.() -> Unit = {}): DebugParam<String?>

Declares a string parameter named name.

Link copied to clipboard
fun strings(name: String, declare: DebugStringSpec.() -> Unit = {}): DebugParam<List<String>?>

Declares a string parameter named name that the request can give more than once, such as ?ids=a&ids=b: its value is every value that the request gives, in order, and each one must fit the options of declare. In a JSON body, the field is an array of strings.