Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation incorrect on JSON serialization, missing include_metadata argument #665

Open
2 tasks done
penoux opened this issue Oct 6, 2020 · 0 comments · May be fixed by #666
Open
2 tasks done

Documentation incorrect on JSON serialization, missing include_metadata argument #665

penoux opened this issue Oct 6, 2020 · 0 comments · May be fixed by #666

Comments

@penoux
Copy link

penoux commented Oct 6, 2020

Checklist

  • I have included information about relevant versions
  • I have verified that the issue persists when using the master branch of Faust.

Steps to reproduce

The models documentation on dumps() for JSON serializing does not state about the include_metadataargument. This is also the case in Models, Serialization, and Codecs section of the documentation.

>>> class LogEvent(Record, serializer='json'):
...     severity: str
...     message: str
...     timestamp: float
...     optional_field: str = 'default value'
...

>>> event = LogEvent(
...     severity='error',
...     message='Broken pact',
...     timestamp=666.0,
... )
>>> event.dumps()
b'{"severity": "error", "message": "Broken pact", "timestamp": 666.0, "optional_field": "default value", "__faust": {"ns": "__main__.LogEvent"}}'

Expected behavior

Expected behavior as per the actual documentation is:

>>> event.dumps()
b'{"severity": "error", "message": "Broken pact", "timestamp": 666.0, "optional_field": "default value"}'

Actual behavior

The include_metadata=False additional argument is necessary to get the expected behavior. It is undocumented though.

Versions

  • Python version: 3.8.5
  • Faust version: 1.10.4
  • Operating system: MacOS Catalina
  • Kafka version: 2.6.0
  • RocksDB version (if applicable): N/A
Kuzyashin added a commit to Kuzyashin/faust that referenced this issue Oct 7, 2020
@Kuzyashin Kuzyashin linked a pull request Oct 7, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant