Skip to main content

invalid_attribute

Macro invalid_attribute 

Source
macro_rules! invalid_attribute {
    ($ctx:expr, $detail:expr $(,)?) => { ... };
    ($ctx:expr, $detail:expr, $field:expr $(,)?) => { ... };
}
Expand description

A 422 naming the attribute at fault.

The third argument is an attribute name, not a pointer: message becomes /data/attributes/message, and a dotted address.city nests. Omit it when no single member is to blame.

let err = ash_jsonapi::invalid_attribute!(ctx, "must not be empty", "message");
let err = ash_jsonapi::invalid_attribute!(ctx, "one of `from`/`to` is required");