From 781e2e58e03a275c55cf7cddc33aaab191548d81 Mon Sep 17 00:00:00 2001 From: alexey Date: Wed, 7 Oct 2020 23:40:42 +0300 Subject: [PATCH 1/2] Fix https://github.com/robinhood/faust/issues/665 --- faust/models/record.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faust/models/record.py b/faust/models/record.py index ca1d26bc9..e834c7251 100644 --- a/faust/models/record.py +++ b/faust/models/record.py @@ -63,7 +63,7 @@ class Record(Model, abstract=True): # type: ignore """Describes a model type that is a record (Mapping). Examples: - >>> class LogEvent(Record, serializer='json'): + >>> class LogEvent(Record, serializer='json', inlcude_metadata=False): ... severity: str ... message: str ... timestamp: float From 8948ddeb7dd63b82112a41c273f215456a096d30 Mon Sep 17 00:00:00 2001 From: alexey Date: Fri, 9 Oct 2020 13:30:13 +0300 Subject: [PATCH 2/2] Docs fix --- docs/userguide/models.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/userguide/models.rst b/docs/userguide/models.rst index 53fa6fe59..f897318d0 100644 --- a/docs/userguide/models.rst +++ b/docs/userguide/models.rst @@ -36,6 +36,14 @@ serializes to: >>> Point(x=10, y=100).dumps() {"x": 10, "y": 100} +Without `include_metadata=False` argument the Point model +serializes to: + +.. sourcecode:: pycon + + >>> Point(x=10, y=100).dumps() + {"x": 10, "y": 100, "__faust": {"ns": "myapp.Point"}} + To temporarily use a different serializer, provide that as an argument to ``.dumps``: