You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-guide/fields.md
+18-1
Original file line number
Diff line number
Diff line change
@@ -380,7 +380,7 @@ A field class that validates a list of objects.
380
380
381
381
**Signature**: `ListField(child)`
382
382
383
-
-`child` - A field instance that should be used for validating the objects in the list.
383
+
-`child` - A field instance that should be used for validating the objects in the list. If this argument is not provided then objects in the list will not be validated.
384
384
385
385
For example, to validate a list of integers you might use something like the following:
386
386
@@ -395,6 +395,23 @@ The `ListField` class also supports a declarative style that allows you to write
395
395
396
396
We can now reuse our custom `StringListField` class throughout our application, without having to provide a `child` argument to it.
397
397
398
+
## DictField
399
+
400
+
A field class that validates a dictionary of objects. The keys in `DictField` are always assumed to be string values.
401
+
402
+
**Signature**: `DictField(child)`
403
+
404
+
-`child` - A field instance that should be used for validating the values in the dictionary. If this argument is not provided then values in the mapping will not be validated.
405
+
406
+
For example, to create a field that validates a mapping of strings to strings, you would write something like this:
407
+
408
+
document = DictField(child=CharField())
409
+
410
+
You can also use the declarative style, as with `ListField`. For example:
0 commit comments