#[derive(Payload)]Expand description
Generates a struct with the same structure of the implementing struct
with all its fields as options. This can only be used on struct that implement Validify.
Any nested structs must also contain their corresponding payloads.
The payload struct is Deserializable, has From and Into impls for
the original, and implements Validate.
The original struct gets a ValidatePayload implementation with 2 associated functions;
validify_from which will validate the payload and call Validify on the original,
and
validate_from which does the same, but calls Validate instead of Validify
on the original.
Both functions return the original struct if the validation succeeds.
The payload can be used to represent a completely deserializable version of the struct even when some fields are missing.
This can be used for more detailed descriptions of what fields are missing, along with any other validation errors.
Example:
#[derive(Debug, Clone, serde::Deserialize, validify::Validify, validify::Payload)]
struct Data {
a: String,
b: Option<String>
}Expands to:
#[derive(Debug, validify::Validate, serde::Deserialize)]
struct DataPayload {
#[validate(required)]
a: Option<String>,
b: Option<String>
}