AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::val::Required Struct Reference

Required field constraint. More...

#include <constraints.hpp>

Collaboration diagram for anch::val::Required:

Detailed Description

Required field constraint.

The field has to be present (checked by the format: anch-json raises anch::json::MappingError with MISSING_FIELD error code).
A null value is accepted only when the field can hold it ( std::optional , std::shared_ptr , std::unique_ptr or pointer): otherwise the format reports a constraint violation ( anch-json: CONSTRAINT_VIOLATION error code).

mapper
.registerField("id", &Pet::id, anch::val::required)
.registerField("owner", &Pet::owner, anch::val::required); // std::optional: present, can be null
Author
Vincent Lachenal
Since
0.2

The documentation for this struct was generated from the following file: