{ "info": { "author": "Stephen Fuhry", "author_email": "fuhrysteve@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "marshmallow-jsonschema: JSON Schema formatting with marshmallow\n---------------------------------------------------------------\n\n|Build Status| |Coverage Status| |Code style: black|\n\nmarshmallow-jsonschema translates marshmallow schemas into JSON Schema\nDraft v7 compliant jsonschema. See http://json-schema.org/\n\nWhy would I want my schema translated to JSON?\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nWhat are the use cases for this? Let's say you have a marshmallow schema\nin python, but you want to render your schema as a form in another\nsystem (for example: a web browser or mobile device).\n\nInstallation\n^^^^^^^^^^^^\n\n::\n\n pip install marshmallow-jsonschema\n\nSome Client tools can render forms using JSON Schema\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- https://github.com/brutusin/json-forms\n- https://github.com/mozilla-services/react-jsonschema-form\n- https://github.com/jdorn/json-editor\n- https://github.com/ulion/jsonform\n\nSimple Example\n^^^^^^^^^^^^^^\n\n.. code:: python\n\n from marshmallow import Schema, fields\n from marshmallow_jsonschema import JSONSchema\n\n class UserSchema(Schema):\n username = fields.String()\n age = fields.Integer()\n birthday = fields.Date()\n\n user_schema = UserSchema()\n\n json_schema = JSONSchema()\n json_schema.dump(user_schema).data\n\nYields:\n\n.. code:: python\n\n {'properties': {'age': {'format': 'integer',\n 'title': 'age',\n 'type': 'number'},\n 'birthday': {'format': 'date',\n 'title': 'birthday',\n 'type': 'string'},\n 'username': {'title': 'username', 'type': 'string'}},\n 'required': [],\n 'type': 'object'}\n\nNested Example\n^^^^^^^^^^^^^^\n\n.. code:: python\n\n from marshmallow import Schema, fields\n from marshmallow_jsonschema import JSONSchema\n from tests import UserSchema\n\n\n class Athlete(object):\n user_schema = UserSchema()\n\n def __init__(self):\n self.name = 'sam'\n\n\n class AthleteSchema(Schema):\n user_schema = fields.Nested(JSONSchema)\n name = fields.String()\n\n \n athlete = Athlete()\n athlete_schema = AthleteSchema()\n\n athlete_schema.dump(athlete).data\n\nComplete example Flask application using brutisin/json-forms\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n[Screenshot] (http://i.imgur.com/jJv1wFk.png)\n\nThis example renders a form not dissimilar to how\n`wtforms `__ might render a form.\n\nHowever rather than rendering the form in python, the JSON Schema is\nrendered using the javascript library\n`brutusin/json-forms `__.\n\n.. code:: python\n\n from flask import Flask, jsonify\n from marshmallow import Schema, fields\n from marshmallow_jsonschema import JSONSchema\n\n app = Flask(__name__)\n\n\n class UserSchema(Schema):\n name = fields.String()\n address = fields.String()\n\n\n @app.route('/schema')\n def schema():\n schema = UserSchema()\n return jsonify(JSONSchema().dump(schema).data)\n\n\n @app.route('/')\n def home():\n return '''\n \n \n \n \n \n \n \n \n
\n \n \n '''\n\n\n if __name__ == '__main__':\n app.run(host='0.0.0.0', debug=True)\n\nCustom Type support\n^^^^^^^^^^^^^^^^^^^\n\nSimply add a ``_jsonschema_type_mapping`` method to your field so we\nknow how it ought to get serialized to JSON Schema.\n\nA common use case for this is creating a dropdown menu using enum (see\nGender below).\n\n.. code:: python\n\n class Colour(fields.Field):\n\n def _jsonschema_type_mapping(self):\n return {\n 'type': 'string',\n }\n\n def _serialize(self, value, attr, obj):\n r, g, b = value\n r = hex(r)[2:]\n g = hex(g)[2:]\n b = hex(b)[2:]\n return '#' + r + g + b \n\n class Gender(fields.String):\n def _jsonschema_type_mapping(self):\n return {\n 'type': 'string',\n 'enum': ['Male', 'Female']\n }\n\n\n class UserSchema(Schema):\n name = fields.String(required=True)\n favourite_colour = Colour()\n gender = Gender()\n\n schema = UserSchema()\n json_schema = JSONSchema()\n json_schema.dump(schema).data\n\n.. |Build Status| image:: https://travis-ci.org/fuhrysteve/marshmallow-jsonschema.svg?branch=master\n :target: https://travis-ci.org/fuhrysteve/marshmallow-jsonschema\n.. |Coverage Status| image:: https://coveralls.io/repos/github/fuhrysteve/marshmallow-jsonschema/badge.svg?branch=master\n :target: https://coveralls.io/github/fuhrysteve/marshmallow-jsonschema?branch=master\n.. |Code style: black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/python/black\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/fuhrysteve/marshmallow-jsonschema", "keywords": "marshmallow-jsonschema marshmallow schema serialization jsonschema validation", "license": "The MIT License (MIT)\n\nCopyright (c) 2016 Stephen J. Fuhry\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n", "maintainer": "", "maintainer_email": "", "name": "marshmallow-jsonschema", "package_url": "https://pypi.org/project/marshmallow-jsonschema/", "platform": "", "project_url": "https://pypi.org/project/marshmallow-jsonschema/", "project_urls": { "Homepage": "https://github.com/fuhrysteve/marshmallow-jsonschema" }, "release_url": "https://pypi.org/project/marshmallow-jsonschema/0.8.0/", "requires_dist": null, "requires_python": "", "summary": "JSON Schema Draft v4 (http://json-schema.org/) formatting with marshmallow", "version": "0.8.0" }, "last_serial": 5944896, "releases": { "0.1.0": [], "0.1.1": [ { "comment_text": "", "digests": { "md5": "938cec38892129a07a9c0d1d8f528dd3", "sha256": "6f9b2d961a895b84d93e7675705a7a0bc6f14e0842770ab9c44a3d1c61f05c5f" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.1.1.tar.gz", "has_sig": false, "md5_digest": "938cec38892129a07a9c0d1d8f528dd3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3988, "upload_time": "2016-03-16T00:05:11", "url": "https://files.pythonhosted.org/packages/a6/53/1236a9a2fff48a5cb97fb6b6f42becfadead6f175d1ce31e7c0c1c214ed2/marshmallow-jsonschema-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "31a489a27a205e1024373a6cb1c29555", "sha256": "4a19531e5a7f71fda942707fa23d3fa4b87455f9b688aed9d9f2544020e7d213" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.1.2.tar.gz", "has_sig": false, "md5_digest": "31a489a27a205e1024373a6cb1c29555", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4001, "upload_time": "2016-03-16T00:05:55", "url": "https://files.pythonhosted.org/packages/55/82/7d669591d08eecb7ac98caf0070bb7e2d2032f9fc9066d372656c4c4ea00/marshmallow-jsonschema-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "aa66dd1a8b24ba5f0d890940cee329b3", "sha256": "d7e6f1f7e01e305e5e0ff94a2325cf8a6fa428b29e27b027312a2f23fb214f81" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.1.3.tar.gz", "has_sig": false, "md5_digest": "aa66dd1a8b24ba5f0d890940cee329b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4013, "upload_time": "2016-03-16T00:08:30", "url": "https://files.pythonhosted.org/packages/85/6b/c44b886af1e85dcd6db8a95700362c1f451500872c2a3f8310b23e4c969c/marshmallow-jsonschema-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "5a1e0642d55667d4bc5cb3eaa92a030e", "sha256": "27710e2e39ce2f243bf688e4dd12164b1e88694fbbcd1079322e0bd96fd937e1" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.1.4.tar.gz", "has_sig": false, "md5_digest": "5a1e0642d55667d4bc5cb3eaa92a030e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4453, "upload_time": "2016-03-16T00:11:15", "url": "https://files.pythonhosted.org/packages/41/8b/a04dd51432f7d26190f1272742aabd652165db3d0aa7cc8de8fda44c7f24/marshmallow-jsonschema-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "009f57b0b05a0a57746a96577b898289", "sha256": "167928c313fc77d28da04e7d1ca6fd78444016c00fe063f1ed318187614cf048" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.1.5.tar.gz", "has_sig": false, "md5_digest": "009f57b0b05a0a57746a96577b898289", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4682, "upload_time": "2016-03-16T16:04:51", "url": "https://files.pythonhosted.org/packages/bd/f3/4f78384b3cba91278aed5776ee056aee57b1603f2e1f386c45a7c9c203b7/marshmallow-jsonschema-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "7996286ffd29132b4be45d0762688002", "sha256": "b30bc8d7e826e20484d608e1afd2dccd58c21a64efa0c86afbd012e6b5d0d8f1" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.1.6.tar.gz", "has_sig": false, "md5_digest": "7996286ffd29132b4be45d0762688002", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4691, "upload_time": "2016-03-16T16:13:41", "url": "https://files.pythonhosted.org/packages/93/1e/55e4937bc5ef1029b982f823345a42936b208a310b2cef6851cea6d8ce1f/marshmallow-jsonschema-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "7fa971514592dfd7ce241e8a015ef1a0", "sha256": "c1945ef66153b63f431645801a643832d1f2d8e67a17039d9131f138376e54f0" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.1.7.tar.gz", "has_sig": false, "md5_digest": "7fa971514592dfd7ce241e8a015ef1a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5476, "upload_time": "2016-03-16T20:01:31", "url": "https://files.pythonhosted.org/packages/e0/c6/30be53866793aafec95108f6f3ad083f412e15cdf70df1984f4c2c01afc9/marshmallow-jsonschema-0.1.7.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "766a407ee2c0172c91a6c0b9788de089", "sha256": "7055ef9d27afad09e499a15ce63f8e766bfabc3ea763e0e6afa33162b40b34ff" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.2.0.tar.gz", "has_sig": false, "md5_digest": "766a407ee2c0172c91a6c0b9788de089", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5563, "upload_time": "2016-05-25T11:52:32", "url": "https://files.pythonhosted.org/packages/93/db/2ead5c1a4e11ec037f934afcd15744b493ef548e2accaee3d61b604a4c58/marshmallow-jsonschema-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "b9a226edb165c242a0148b9e89152d94", "sha256": "18124d438379262915ad56040b182fcbbdaf0fa13d26cc3f60d4befe0fc5bfed" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.2.1.tar.gz", "has_sig": false, "md5_digest": "b9a226edb165c242a0148b9e89152d94", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5716, "upload_time": "2016-05-25T11:58:42", "url": "https://files.pythonhosted.org/packages/dd/17/9598a788ca919aa79ae8f24aa184fb458bc1f98669db4b1ebd56ff32bfe8/marshmallow-jsonschema-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "aac2eefdff2d7b7c2ab97145b3a573cf", "sha256": "5d33f961b8e682730ec6e12edb4fe19dddd9655051ad01eb5912e232f0635ef3" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.3.0.tar.gz", "has_sig": false, "md5_digest": "aac2eefdff2d7b7c2ab97145b3a573cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6632, "upload_time": "2016-07-12T18:32:50", "url": "https://files.pythonhosted.org/packages/e3/67/1e8fb6a1f2a49d09817a3487c832a31e25628ddf70fe0a5fb945b36e83b2/marshmallow-jsonschema-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "59f305de7bc4601ccfe4c668a1ba4688", "sha256": "43b5881671b60bcff7d3bd64cc864d17b3cc69c8f193ac0a6d2f4e21737ad295" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.4.0.tar.gz", "has_sig": false, "md5_digest": "59f305de7bc4601ccfe4c668a1ba4688", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6615, "upload_time": "2017-07-13T19:23:28", "url": "https://files.pythonhosted.org/packages/4e/07/148e94b8d68c5822b02735bb9e302051c72f8cb21edbd0534b11326a8e90/marshmallow-jsonschema-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "ed89dd25b7fd5da99fbc55efa09306ce", "sha256": "dfe081f1a43c2bbd2a0a999f98c79f98f465fb8c896ab3f44717cda829b71ead" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.5.0.tar.gz", "has_sig": false, "md5_digest": "ed89dd25b7fd5da99fbc55efa09306ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7380, "upload_time": "2017-12-13T16:27:27", "url": "https://files.pythonhosted.org/packages/0f/f5/f72f87b4ec56fef840b7cd14527f6c659cd9e9e35148ffc9f5da3f3f3e14/marshmallow-jsonschema-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "3878471004729d1d598788408477a831", "sha256": "9b49820535e9c50877053793bc18ed16a7d75b00edacc62f5075e30e9e111788" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.6.0.tar.gz", "has_sig": false, "md5_digest": "3878471004729d1d598788408477a831", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8050, "upload_time": "2019-06-16T16:51:33", "url": "https://files.pythonhosted.org/packages/91/91/99efb319fb70f9037108fbe98c3d433c30a7da4f882822ca0657fef104ae/marshmallow-jsonschema-0.6.0.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "726cf6e0687ab3aecfd9102db267bb3e", "sha256": "24ffa544af45f4c116fc1e61a29fc1f70ae8ed480c19c7bef35070bbb89135a1" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.7.0.tar.gz", "has_sig": false, "md5_digest": "726cf6e0687ab3aecfd9102db267bb3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9900, "upload_time": "2019-08-11T14:59:15", "url": "https://files.pythonhosted.org/packages/72/74/9e9676159e1b2e71498639500db58db924b537694ee38b2dbba30079e45b/marshmallow-jsonschema-0.7.0.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "0fb1fcebea16aa30772b0ef3a491e77e", "sha256": "c8fb576a8262f771322d412e39fc59ada10b62f158590127a7ddd82644e4862b" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.8.0.tar.gz", "has_sig": false, "md5_digest": "0fb1fcebea16aa30772b0ef3a491e77e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9908, "upload_time": "2019-10-08T13:59:37", "url": "https://files.pythonhosted.org/packages/b6/a3/5ddcbd3b1dc24f5d08b119678d02483dd52770161fc825a8d17ceb3f08d4/marshmallow-jsonschema-0.8.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0fb1fcebea16aa30772b0ef3a491e77e", "sha256": "c8fb576a8262f771322d412e39fc59ada10b62f158590127a7ddd82644e4862b" }, "downloads": -1, "filename": "marshmallow-jsonschema-0.8.0.tar.gz", "has_sig": false, "md5_digest": "0fb1fcebea16aa30772b0ef3a491e77e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9908, "upload_time": "2019-10-08T13:59:37", "url": "https://files.pythonhosted.org/packages/b6/a3/5ddcbd3b1dc24f5d08b119678d02483dd52770161fc825a8d17ceb3f08d4/marshmallow-jsonschema-0.8.0.tar.gz" } ] }