class RecursionRefSerializerTwo(Serializer): name = StringField() ref_one = SerializerField('RecursionRefSerializerOne', exclude=['sers'], required=True) ref_two = SerializerField('RecursionRefSerializerOne', exclude=['sers'], required=True)
class TestNestSerializer(Serializer): class NestSerializer(Serializer): name = StringField(required=True) id = IntegerField(required=True, identity=True) planet = StringField(required=True) os = StringField(required=True) _type = TypeField('test_object') id = IntegerField(required=True, identity=True) name = StringField(required=True) nest = SerializerField(NestSerializer, fields=['name'], required=True)
class MySerializer(Serializer): class MyNestSerializer(Serializer): name = StringField(required=True) id = IntegerField(required=True, identity=True) _type = TypeField('test_object') id = IntegerField(required=True, identity=True) name = StringField(required=True) date_var = DateField(required=True, map_field='dt') time_var = TimeField(required=True, map_field='t') url = UrlField(required=True, base='http://www.base.com', default='api') nest = SerializerField(MyNestSerializer, required=True)
class TestNestSerializer(Serializer): class NestSerializer(Serializer): name = StringField(required=True) id = IntegerField(required=True, identity=True) _type = TypeField('test_object') id = IntegerField(required=True, identity=True) name = StringField(required=True) street = StringField(required=False, on_null=HIDE_FIELD) uuid_var = UUIDField(required=True) maxmin = IntegerField(max_value=10, min_value=6, required=True) datetime_var = DatetimeField(required=True) date_var = DateField(required=True) time_var = TimeField(required=True) haus = StringField(required=True, map_field='house') url = UrlField(required=True, base='http://www.base.com', default='api') nest = SerializerField(NestSerializer, required=True)
class KnownTestSerialzer(Serializer): code = StringField(required=True, max_length=3) number = IntegerField(required=True) address = SerializerField(NestKnownTestSerialzer, required=True, fields=['street'])
class KnownTestSerialzer(Serializer): code = StringField(required=True, max_length=3) number = IntegerField(required=True) address = SerializerField(UnknownTestSerialzer, required=True)
class LazyFieldSerializer(Serializer): nest = SerializerField('NotASerializer', required=True)
class LazyFieldSerializer(Serializer): _type = TypeField('test_object') id = IntegerField(required=True, identity=True) nest = SerializerField('LazyFieldNestSerializer', required=True)
class NotRequiredSerializerField(Serializer): name = StringField() nest = SerializerField(NotRequiredNest, required=False)