@@ -57,6 +57,12 @@ def to_internal_value(self, data):
5757
5858
5959class SparseFieldsetsMixin (object ):
60+ """
61+ A serializer mixin that adds support for sparse fieldsets through `fields` query parameter.
62+
63+ Specification: https://jsonapi.org/format/#fetching-sparse-fieldsets
64+ """
65+
6066 def __init__ (self , * args , ** kwargs ):
6167 super (SparseFieldsetsMixin , self ).__init__ (* args , ** kwargs )
6268 context = kwargs .get ('context' )
@@ -85,6 +91,13 @@ def __init__(self, *args, **kwargs):
8591
8692
8793class IncludedResourcesValidationMixin (object ):
94+ """
95+ A serializer mixin that adds validation of `include` query parameter to
96+ support compound documents.
97+
98+ Specification: https://jsonapi.org/format/#document-compound-documents)
99+ """
100+
88101 def __init__ (self , * args , ** kwargs ):
89102 context = kwargs .get ('context' )
90103 request = context .get ('request' ) if context else None
@@ -147,6 +160,20 @@ class Serializer(
147160 IncludedResourcesValidationMixin , SparseFieldsetsMixin , Serializer ,
148161 metaclass = SerializerMetaclass
149162):
163+ """
164+ A `Serializer` is a model-less serializer class with additional
165+ support for json:api spec features.
166+
167+ As in json:api specification a type is always required you need to
168+ make sure that you define `resource_name` in your `Meta` class
169+ when deriving from this class.
170+
171+ Included Mixins:
172+
173+ * A mixin class to enable sparse fieldsets is included
174+ * A mixin class to enable validation of included resources is included
175+ """
176+
150177 pass
151178
152179
0 commit comments