1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! Context models and metadata descriptors for hybrid client-side GraphQL query validation.
//!
//! Provides diagnostic metadata passed into custom validation predicates, enabling localized
//! reporting of schema constraint violations prior to outbound network dispatch.
//!
//! ### Custom Predicate Integration
//!
//! When defining a query builder via [`define_query_builder!`](crate::define_query_builder),
//! custom validation rules tagged with `#[validate(custom = path)]` receive a reference to the
//! argument value and an immutable [`ArgMeta`] descriptor.
//!
//! ### Quick Example
//!
//! ```rust
//! use moongraphql_builder::validation::ArgMeta;
//!
//! /// Custom validator ensuring a string search term is not blank
//! fn validate_non_blank(value: &String, meta: &ArgMeta) -> Result<(), String> {
//! if value.trim().is_empty() {
//! return Err(format!(
//! "Argument '{}' in query '{}' cannot consist solely of whitespace",
//! meta.arg_name, meta.root_query
//! ));
//! }
//! Ok(())
//! }
//! ```
/// Metadata descriptor for a validated argument passed into custom validation predicates.
///
/// Carries source code identifiers, remote GraphQL schema parameter names, and the root query context.