Skip to content

Commit 4cd975a

Browse files
committed
better doc
1 parent 01d7c86 commit 4cd975a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/definitions.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ use crate::build_tools::py_err;
1414
// An integer id for the reference
1515
pub type ReferenceId = usize;
1616

17-
/// Definitions for validators or serializers
18-
/// They get indexed by a ReferenceId,
19-
/// which are handed out and managed by DefinitionsBuilder
17+
/// Definitions are validators and serializers that are
18+
/// shared by reference.
19+
/// They come into play whenever there is recursion, e.g.
20+
/// if you have validators A -> B -> A then A will be shared
21+
/// by reference so that the SchemaValidator itself can own it.
22+
/// These primarily get used by DefinitionRefValidator and DefinitionRefSerializer,
23+
/// other validators / serializers primarily pass them around without interacting with them.
24+
/// They get indexed by a ReferenceId, which are integer identifiers
25+
/// that are handed out and managed by DefinitionsBuilder when the Schema{Validator,Serializer}
26+
/// gets build.
2027
pub type Definitions<T> = [T];
2128

2229
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)