RequiredConditionV1

toloka.client.project.template_builder.conditions.RequiredConditionV1 | Source code

RequiredConditionV1(
self,
data: Optional[Any] = None,
*,
hint: Optional[Any] = None,
version: Optional[str] = '1.0.0'
)

Checks that a data field is present in a response.

For more information, see condition.required.

Parameters description

ParametersTypeDescription
dataOptional[Any]

The data field. If it is not specified, the data of the parent component is used.

hintOptional[Any]

A hint that is shown if the condition is not met.

Examples:

How to check that image is uploaded.

import toloka.client.project.template_builder as tb
image = tb.fields.MediaFileFieldV1(
tb.data.OutputData('image'),
tb.fields.MediaFileFieldV1.Accept(photo=True, gallery=True),
validation=tb.conditions.RequiredConditionV1(hint='You must upload a photo.'),
)

Last updated: August 28, 2023

Toloka-Kit
OverviewGetting API keyQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming