*******************
marshmallow-jsonapi
*******************
.. image:: https://badgen.net/pypi/v/marshmallow-jsonapi
:target: https://pypi.org/project/marshmallow-jsonapi/
:alt: PyPI version
.. image:: https://dev.azure.com/sloria/sloria/_apis/build/status/marshmallow-code.marshmallow-jsonapi?branchName=dev
:target: https://dev.azure.com/sloria/sloria/_build/latest?definitionId=7&branchName=dev
:alt: Build status
.. image:: https://readthedocs.org/projects/marshmallow-jsonapi/badge/
:target: https://marshmallow-jsonapi.readthedocs.io/
:alt: Documentation
.. image:: https://badgen.net/badge/marshmallow/3
:target: https://marshmallow.readthedocs.io/en/latest/upgrading.html
:alt: marshmallow 3 compatible
.. image:: https://badgen.net/badge/code%20style/black/000
:target: https://github.com/ambv/black
:alt: code style: black
Homepage: http://marshmallow-jsonapi.readthedocs.io/
JSON API 1.0 (`https://jsonapi.org <http://jsonapi.org/>`_) formatting with `marshmallow <https://marshmallow.readthedocs.io>`_.
marshmallow-jsonapi provides a simple way to produce JSON API-compliant data in any Python web framework.
.. code-block:: python
from marshmallow_jsonapi import Schema, fields
class PostSchema(Schema):
id = fields.Str(dump_only=True)
title = fields.Str()
author = fields.Relationship(
"/authors/{author_id}", related_url_kwargs={"author_id": "<author.id>"}
)
comments = fields.Relationship(
"/posts/{post_id}/comments",
related_url_kwargs={"post_id": "<id>"},
# Include resource linkage
many=True,
include_resource_linkage=True,
type_="comments",
)
class Meta:
type_ = "posts"
post_schema = PostSchema()
post_schema.dump(post)
# {
# "data": {
# "id": "1",
# "type": "posts"
# "attributes": {
# "title": "JSON API paints my bikeshed!"
# },
# "relationships": {
# "author": {
# "links": {
# "related": "/authors/9"
# }
# },
# "comments": {
# "links": {
# "related": "/posts/1/comments/"
# }
# "data": [
# {"id": 5, "type": "comments"},
# {"id": 12, "type": "comments"}
# ],
# }
# },
# }
# }
Installation
============
::
pip install marshmallow-jsonapi
Documentation
=============
Full documentation is available at https://marshmallow-jsonapi.readthedocs.io/.
Requirements
============
- Python >= 3.6
Project Links
=============
- Docs: http://marshmallow-jsonapi.readthedocs.io/
- Changelog: http://marshmallow-jsonapi.readthedocs.io/en/latest/changelog.html
- Contributing Guidelines: https://marshmallow-jsonapi.readthedocs.io/en/latest/contributing.html
- PyPI: https://pypi.python.org/pypi/marshmallow-jsonapi
- Issues: https://github.com/marshmallow-code/marshmallow-jsonapi/issues
License
=======
MIT licensed. See the bundled `LICENSE <https://github.com/marshmallow-code/marshmallow-jsonapi/blob/master/LICENSE>`_ file for more details.
Raw data
{
"_id": null,
"home_page": "https://github.com/marshmallow-code/marshmallow-jsonapi",
"name": "marshmallow-jsonapi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "marshmallow-jsonapi marshmallow marshalling serialization jsonapi deserialization validation",
"author": "Steven Loria",
"author_email": "sloria1@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/42/8e/5148bdc8ffb44e03a259ac4c824d568ad9ce2653c63e216382ee94308bc3/marshmallow-jsonapi-0.24.0.tar.gz",
"platform": "",
"description": "*******************\nmarshmallow-jsonapi\n*******************\n\n.. image:: https://badgen.net/pypi/v/marshmallow-jsonapi\n :target: https://pypi.org/project/marshmallow-jsonapi/\n :alt: PyPI version\n\n.. image:: https://dev.azure.com/sloria/sloria/_apis/build/status/marshmallow-code.marshmallow-jsonapi?branchName=dev\n :target: https://dev.azure.com/sloria/sloria/_build/latest?definitionId=7&branchName=dev\n :alt: Build status\n\n.. image:: https://readthedocs.org/projects/marshmallow-jsonapi/badge/\n :target: https://marshmallow-jsonapi.readthedocs.io/\n :alt: Documentation\n\n.. image:: https://badgen.net/badge/marshmallow/3\n :target: https://marshmallow.readthedocs.io/en/latest/upgrading.html\n :alt: marshmallow 3 compatible\n\n.. image:: https://badgen.net/badge/code%20style/black/000\n :target: https://github.com/ambv/black\n :alt: code style: black\n\nHomepage: http://marshmallow-jsonapi.readthedocs.io/\n\nJSON API 1.0 (`https://jsonapi.org <http://jsonapi.org/>`_) formatting with `marshmallow <https://marshmallow.readthedocs.io>`_.\n\nmarshmallow-jsonapi provides a simple way to produce JSON API-compliant data in any Python web framework.\n\n.. code-block:: python\n\n from marshmallow_jsonapi import Schema, fields\n\n\n class PostSchema(Schema):\n id = fields.Str(dump_only=True)\n title = fields.Str()\n\n author = fields.Relationship(\n \"/authors/{author_id}\", related_url_kwargs={\"author_id\": \"<author.id>\"}\n )\n\n comments = fields.Relationship(\n \"/posts/{post_id}/comments\",\n related_url_kwargs={\"post_id\": \"<id>\"},\n # Include resource linkage\n many=True,\n include_resource_linkage=True,\n type_=\"comments\",\n )\n\n class Meta:\n type_ = \"posts\"\n\n\n post_schema = PostSchema()\n post_schema.dump(post)\n # {\n # \"data\": {\n # \"id\": \"1\",\n # \"type\": \"posts\"\n # \"attributes\": {\n # \"title\": \"JSON API paints my bikeshed!\"\n # },\n # \"relationships\": {\n # \"author\": {\n # \"links\": {\n # \"related\": \"/authors/9\"\n # }\n # },\n # \"comments\": {\n # \"links\": {\n # \"related\": \"/posts/1/comments/\"\n # }\n # \"data\": [\n # {\"id\": 5, \"type\": \"comments\"},\n # {\"id\": 12, \"type\": \"comments\"}\n # ],\n # }\n # },\n # }\n # }\n\nInstallation\n============\n::\n\n pip install marshmallow-jsonapi\n\n\nDocumentation\n=============\n\nFull documentation is available at https://marshmallow-jsonapi.readthedocs.io/.\n\nRequirements\n============\n\n- Python >= 3.6\n\nProject Links\n=============\n\n- Docs: http://marshmallow-jsonapi.readthedocs.io/\n- Changelog: http://marshmallow-jsonapi.readthedocs.io/en/latest/changelog.html\n- Contributing Guidelines: https://marshmallow-jsonapi.readthedocs.io/en/latest/contributing.html\n- PyPI: https://pypi.python.org/pypi/marshmallow-jsonapi\n- Issues: https://github.com/marshmallow-code/marshmallow-jsonapi/issues\n\nLicense\n=======\n\nMIT licensed. See the bundled `LICENSE <https://github.com/marshmallow-code/marshmallow-jsonapi/blob/master/LICENSE>`_ file for more details.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "JSON API 1.0 (https://jsonapi.org) formatting with marshmallow",
"version": "0.24.0",
"split_keywords": [
"marshmallow-jsonapi",
"marshmallow",
"marshalling",
"serialization",
"jsonapi",
"deserialization",
"validation"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "2bb6b6293063e12cd7ddcc65176b78af",
"sha256": "b7403688297dfe8b89173582811989badbe1328ac36447c5a151c006fbe34d24"
},
"downloads": -1,
"filename": "marshmallow_jsonapi-0.24.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "2bb6b6293063e12cd7ddcc65176b78af",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 14332,
"upload_time": "2020-12-27T16:52:50",
"upload_time_iso_8601": "2020-12-27T16:52:50.667459Z",
"url": "https://files.pythonhosted.org/packages/b6/44/5cf50d083ac6e1ca654e1cbaab0342b1f231591a3cd184f72827eccfa9f3/marshmallow_jsonapi-0.24.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "14711955535ee9850ab13f89278a7a2f",
"sha256": "bd88c0ac0e2ddeb0a3ceb86229963b9f828d898041f29d92a68f585a1feb37b5"
},
"downloads": -1,
"filename": "marshmallow-jsonapi-0.24.0.tar.gz",
"has_sig": false,
"md5_digest": "14711955535ee9850ab13f89278a7a2f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 34563,
"upload_time": "2020-12-27T16:52:52",
"upload_time_iso_8601": "2020-12-27T16:52:52.390373Z",
"url": "https://files.pythonhosted.org/packages/42/8e/5148bdc8ffb44e03a259ac4c824d568ad9ce2653c63e216382ee94308bc3/marshmallow-jsonapi-0.24.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-12-27 16:52:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "marshmallow-code",
"github_project": "marshmallow-jsonapi",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "marshmallow-jsonapi"
}