{ "info": { "author": "Richard Kuesters", "author_email": "rkuesters@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Utilities" ], "description": "=================\n``middle-schema``\n=================\n\n\n\nTranslate your `middle `_ model declarations to OpenAPI, JSONSchema or any other schema you need!\n\nIn a nutshell\n-------------\n\n.. code-block:: pycon\n\n >>> import enum\n >>> import json\n >>> import typing as t\n >>> import middle\n >>> from middle_schema.openapi import parse\n\n >>> @enum.unique\n ... class PlatformEnum(str, enum.Enum):\n ... XBOX1 = \"XBOX1\"\n ... PLAYSTATION4 = \"PLAYSTATION4\"\n ... PC = \"PC\"\n\n >>> @enum.unique\n ... class LanguageEnum(enum.IntEnum):\n ... ENGLISH = 1\n ... JAPANESE = 2\n ... SPANISH = 3\n ... GERMAN = 4\n ... PORTUGUESE = 5\n\n >>> @enum.unique\n ... class CityRegionEnum(str, enum.Enum):\n ... TROPICAL = \"TROPICAL\"\n ... TEMPERATE = \"TEMPERATE\"\n ... BOREAL = \"BOREAL\"\n\n >>> class City(middle.Model):\n ... __description__ = \"One awesome city built\"\n ... name = middle.field(type=str, description=\"The city name\")\n ... region = middle.field(\n ... default=CityRegionEnum.TEMPERATE,\n ... type=CityRegionEnum,\n ... description=\"The region this city is located\",\n ... )\n\n >>> class Player(middle.Model):\n ... nickname = middle.field(\n ... type=str, description=\"The nickname of the player over the internet\"\n ... )\n ... youtube_channel = middle.field(\n ... type=str, description=\"The YouTube channel of the player\", default=None\n ... )\n\n >>> class Game(middle.Model):\n ... __description__ = \"An electronic game model\"\n ... name = middle.field(type=str, description=\"The name of the game\")\n ... platform = middle.field(\n ... type=PlatformEnum, description=\"Which platform it runs on\"\n ... )\n ... score = middle.field(\n ... type=float,\n ... description=\"The average score of the game\",\n ... minimum=0,\n ... maximum=10,\n ... multiple_of=0.1,\n ... )\n ... resolution_tested = middle.field(\n ... type=str,\n ... description=\"The resolution which the game was tested\",\n ... pattern=\"^\\d+x\\d+$\",\n ... )\n ... genre = middle.field(\n ... type=t.List[str],\n ... description=\"One or more genres this game is part of\",\n ... min_items=1,\n ... unique_items=True,\n ... )\n ... rating = middle.field(\n ... type=t.Dict[str, float],\n ... description=\"Ratings given on specialized websites\",\n ... min_properties=3,\n ... )\n ... players = middle.field(\n ... type=t.Set[str],\n ... description=\"Some of the notorious players of this game\",\n ... )\n ... language = middle.field(\n ... type=LanguageEnum, description=\"The main language of the game\"\n ... )\n ... awesome_city = middle.field(type=City)\n ... remarkable_resources = middle.field(\n ... type=t.Union[Player, City],\n ... description=\"Some remarkable resources of this game over the internet\",\n ... )\n\n >>> api = parse(Game)\n\n >>> json.dumps(api.specification, indent=4, sort_keys=True)\n {\n \"description\": \"An electronic game model\",\n \"properties\": {\n \"awesome_city\": {\n \"description\": \"One awesome city built\",\n \"properties\": {\n \"name\": {\n \"description\": \"The city name\",\n \"type\": \"string\"\n },\n \"region\": {\n \"choices\": [\n \"TROPICAL\",\n \"TEMPERATE\",\n \"BOREAL\"\n ],\n \"description\": \"The region this city is located\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\"\n ],\n \"type\": \"object\"\n },\n \"genre\": {\n \"description\": \"One or more genres this game is part of\",\n \"items\": {\n \"type\": \"string\"\n },\n \"minItems\": 1,\n \"type\": \"array\",\n \"uniqueItems\": true\n },\n \"language\": {\n \"choices\": [\n 1,\n 2,\n 3,\n 4,\n 5\n ],\n \"description\": \"The main language of the game\",\n \"format\": \"int64\",\n \"type\": \"integer\"\n },\n \"name\": {\n \"description\": \"The name of the game\",\n \"type\": \"string\"\n },\n \"platform\": {\n \"choices\": [\n \"XBOX1\",\n \"PLAYSTATION4\",\n \"PC\"\n ],\n \"description\": \"Which platform it runs on\",\n \"type\": \"string\"\n },\n \"players\": {\n \"description\": \"Some of the notorious players of this game\",\n \"items\": {\n \"properties\": {\n \"nickname\": {\n \"description\": \"The nickname of the player over the internet\",\n \"type\": \"string\"\n },\n \"youtube_channel\": {\n \"description\": \"The YouTube channel of the player\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"nickname\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"rating\": {\n \"additionalProperties\": {\n \"format\": \"double\",\n \"type\": \"number\"\n },\n \"description\": \"Ratings given on specialized websites\",\n \"minProperties\": 3,\n \"type\": \"object\"\n },\n \"remarkable_resources\": {\n \"anyOf\": [\n {\n \"properties\": {\n \"nickname\": {\n \"description\": \"The nickname of the player over the internet\",\n \"type\": \"string\"\n },\n \"youtube_channel\": {\n \"description\": \"The YouTube channel of the player\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"nickname\"\n ],\n \"type\": \"object\"\n },\n {\n \"description\": \"One awesome city built\",\n \"properties\": {\n \"name\": {\n \"description\": \"The city name\",\n \"type\": \"string\"\n },\n \"region\": {\n \"choices\": [\n \"TROPICAL\",\n \"TEMPERATE\",\n \"BOREAL\"\n ],\n \"description\": \"The region this city is located\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\"\n ],\n \"type\": \"object\"\n }\n ],\n \"description\": \"Some remarkable resources of this game over the internet\"\n },\n \"resolution_tested\": {\n \"description\": \"The resolution which the game was tested\",\n \"pattern\": \"^\\\\d+x\\\\d+$\",\n \"type\": \"string\"\n },\n \"score\": {\n \"description\": \"The average score of the game\",\n \"format\": \"double\",\n \"maximum\": 10,\n \"minimum\": 0,\n \"multipleOf\": 0.1,\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"name\",\n \"platform\",\n \"score\",\n \"resolution_tested\",\n \"genre\",\n \"rating\",\n \"players\",\n \"language\",\n \"awesome_city\",\n \"remarkable_resources\"\n ],\n \"type\": \"object\"\n }\n\n\n.. warning::\n\n **IMPORTANT**: ``middle`` and ``middle-schema`` are in **very early stages** of development! Use with caution and be aware that some functionalities and APIs may change between versions until they're out of **alpha**.\n\nDocumentation\n=============\n\nhttps://middle-schema.readthedocs.io/en/latest/\n\nLicense\n=======\n\n``middle-schema`` is a free software distributed under the `MIT `_ license.\n\n\nChangelog\n=========\n\nv0.2.0 on 2018-08-01\n--------------------\n\n* Small refactoring on the Skeleton parser;\n* OpenAPI component and schema generation of ``middle`` models;\n* 99%+ of code coverage.\n\n\nv0.1.0 on 2018-07-26\n--------------------\n\n* First release on PyPI. Not stable.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/vltr/middle-schema", "keywords": "middle,models,hooks,customizable,openapi,swagger,jsonschema,schema", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "middle-schema", "package_url": "https://pypi.org/project/middle-schema/", "platform": "", "project_url": "https://pypi.org/project/middle-schema/", "project_urls": { "Homepage": "https://github.com/vltr/middle-schema" }, "release_url": "https://pypi.org/project/middle-schema/0.2.0/", "requires_dist": [ "middle (>=0.2.0)" ], "requires_python": "", "summary": "Translate your middle model declarations to OpenAPI, JSONSchema or any other schema you need", "version": "0.2.0" }, "last_serial": 4125755, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "49ecee5d6ee5f34e8c26e59913191d4f", "sha256": "64e1ad7dc1254e2a685f168b2fbf78e93594ee0e85cbb1c9f8dafd0c96778179" }, "downloads": -1, "filename": "middle_schema-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "49ecee5d6ee5f34e8c26e59913191d4f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6450, "upload_time": "2018-07-27T20:48:49", "url": "https://files.pythonhosted.org/packages/d9/94/e0540496121010b3e217909717d3fd627a85b36b290be59e4e2804eb6af3/middle_schema-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "55586e2489c26b65fa9d1be94ea81b1d", "sha256": "a49d51a82fb1d7b1064bdf410d2d90614649760809f2264ecb0cbcc9804ca084" }, "downloads": -1, "filename": "middle-schema-0.1.0.tar.gz", "has_sig": false, "md5_digest": "55586e2489c26b65fa9d1be94ea81b1d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 38351, "upload_time": "2018-07-27T20:49:09", "url": "https://files.pythonhosted.org/packages/26/88/9b7031bfa171b400c833fc12348de329f011e222370a58169d53ebbdc0e8/middle-schema-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "391a78fef047ea4dfdd218780d4f4ad1", "sha256": "7d085cb27be48e57a1beef7008ad07f40b6be6bfecd11e575137403f15f690a9" }, "downloads": -1, "filename": "middle_schema-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "391a78fef047ea4dfdd218780d4f4ad1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7471, "upload_time": "2018-08-01T18:29:11", "url": "https://files.pythonhosted.org/packages/05/8e/f0d4467159d887fd79a6152edd275b88767cd74a1c7995a5e03349fb794d/middle_schema-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "83a5ab7710e6b50d2d7c300485d73023", "sha256": "64ccdb5fc77f41ab68c2d5011c104e2306816b19b6baa3bc52362f1fec526a3d" }, "downloads": -1, "filename": "middle-schema-0.2.0.tar.gz", "has_sig": false, "md5_digest": "83a5ab7710e6b50d2d7c300485d73023", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45278, "upload_time": "2018-08-01T18:29:13", "url": "https://files.pythonhosted.org/packages/d2/2f/8931c8ff6aa0d4bd773a5896973f8b1ac2d6069c996fbbfbd8975b326cf1/middle-schema-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "391a78fef047ea4dfdd218780d4f4ad1", "sha256": "7d085cb27be48e57a1beef7008ad07f40b6be6bfecd11e575137403f15f690a9" }, "downloads": -1, "filename": "middle_schema-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "391a78fef047ea4dfdd218780d4f4ad1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7471, "upload_time": "2018-08-01T18:29:11", "url": "https://files.pythonhosted.org/packages/05/8e/f0d4467159d887fd79a6152edd275b88767cd74a1c7995a5e03349fb794d/middle_schema-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "83a5ab7710e6b50d2d7c300485d73023", "sha256": "64ccdb5fc77f41ab68c2d5011c104e2306816b19b6baa3bc52362f1fec526a3d" }, "downloads": -1, "filename": "middle-schema-0.2.0.tar.gz", "has_sig": false, "md5_digest": "83a5ab7710e6b50d2d7c300485d73023", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45278, "upload_time": "2018-08-01T18:29:13", "url": "https://files.pythonhosted.org/packages/d2/2f/8931c8ff6aa0d4bd773a5896973f8b1ac2d6069c996fbbfbd8975b326cf1/middle-schema-0.2.0.tar.gz" } ] }