{ "info": { "author": "Arello Mobile", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Documentation" ], "description": "Swagger to .rst Converter\n=========================\n\n|Build Status|\n\nWhy?\n----\n\nThis tools are written as part of our Documentation Toolkit which we use\nin our job daily. The main idea of toolkit is to make a process of\ncreating and updating documentation able to be automated\n\nOther parts of our toolkit is:\n\n- `py2swagger `__\n- `swagger2rst `__\n- `sphinx-confluence `__\n- `confluence-publisher `__\n\nInstall\n=======\n\nInstall from `PyPI `__ with\n\n::\n\n $ pip install swagger2rst\n\nUsage examples\n--------------\n\nCommand - ``swg2rst``\n\nRequired arguments: - ``path`` - path to a swagger file (\"json\" or\n\"yaml\") - ``--format (-f)`` - output file format. Currenty only \"rst\" is\nsupported (required)\n\nOptions: - ``--output (-o)`` - output filename (default: stdout) -\n``--template (-t)`` - custom template file path (default:\ntemplates/basic.) - ``--examples(-e)`` - custom examples definitions\nfile path (\"json\" or \"yaml\") - ``--inline (-i)`` - put schema\ndefinitions in paths, otherwise in a separate ``Data Structures``\nsection\n\nExample:\n\n.. code:: bash\n\n > swg2rst samples/swagger.json -f rst -o /home/user/rst_docs/swagger.rst\n > swg2rst samples/swagger.json -f rst -o /home/user/rst_docs/swagger.rst -e /home/user/examples.yaml\n > cat docs/swagger.json | swg2rst -f rst -t templates/custom.rst | grep /api\n\nAdditional enhancements\n-----------------------\n\nTo convert GFM descriptions into *restructuredText* install ``pandoc``\nand use custom Jinja filter ``md2rst``\n\n.. code:: bash\n\n > sudo apt-get install pandoc\n > pip install pypandoc\n\n.. code:: python\n\n {{ doc.info['description']|md2rst }}\n\nCustom Examples\n---------------\n\nCustom examples are described in **json** or **yaml**. See ``samples``\ndirectory.\n\nElements\n~~~~~~~~\n\n``array_items_count``\n^^^^^^^^^^^^^^^^^^^^^\n\nNumber of elements in all arrays. Set from 1 to 5. Default: 2.\n\n``definitions``\n^^^^^^^^^^^^^^^\n\nBind fields to examples by definition schemas. Key is a definition\nreference path, value is an object (key is a field name and value is an\nexample):\n\n``json``\n\n.. code:: json\n\n {\n \"definitions\": {\n \"#/definitions/Media\": {\n \"likes.count\": 10,\n \"likes.data.user_name\": \"liked_user\",\n \"user.user_name\": \"my_login\"\n },\n \"#/definitions/MiniProfile\": {\n \"user_name\": \"some_login\",\n \"full_name\": \"John Smith\"\n }\n }\n }\n\n``yaml``\n\n.. code:: yaml\n\n definitions:\n '#/definitions/Media':\n likes.count: 10\n likes.data.user_name: liked_user\n user.user_name: my_login\n '#/definitions/MiniProfile':\n user_name: some_login\n full_name: John Smith\n\n``paths``\n^^^^^^^^^\n\nBind operation fields to examples by path. Should define path, method,\nsection (parameters or responses) and field name\n\n``json``\n\n.. code:: json\n\n {\n \"paths\": {\n \"/users/{user-id}/relationship\": {\n \"post\": {\n \"parameters\": {\n \"action\": \"approve\"\n },\n \"responses\": {\n \"200.data\": {\n \"profile_picture\": \"picture\",\n \"full_name\": \"Kevin Jones\",\n \"id\": 10,\n \"user_name\": \"kevin\"\n }\n }\n }\n }\n }\n }\n\n``yaml``\n\n.. code:: yaml\n\n paths:\n /users/{user-id}/relationship:\n post:\n parameters:\n action: approve\n responses:\n 200.data.profile_picture: picture\n 200.data.full_name: Kevin Jones\n 200.data.id: 10\n 200.data.user_name: kevin\n\n``types``\n^^^^^^^^^\n\nDefine examples for primitive types.\n\nSupported types: - string - date - date-time - number - integer -\nboolean\n\n``json``\n\n.. code:: json\n\n {\n \"types\": {\n \"string\": \"value\",\n \"date\": \"2000-12-01\",\n \"date-time\": \"2000-12-01T12:00:00.000Z\",\n \"number\": 1.2,\n \"integer\": 5,\n \"boolean\": false\n }\n }\n\n``yaml``\n\n.. code:: yaml\n\n types:\n string: value\n date: '2000-12-01'\n date-time: '2000-12-01T12:00:00.000Z'\n number: 1.2\n integer: 5\n boolean: false\n\nExamples priorities\n-------------------\n\nIf a field has several examples, the following priority rules apply\n\n1. Example from operation.\n2. Example from definitions. If a schema has nested schemas, the\n priority is given to an example from a most descriptive. E.g.:\n ``Media`` has nested schema ``MiniProfile``. For ``user_name`` in\n ``likes`` in ``Media`` an example will be taken from\n ``#/definitions/Media/likes.data.user_name`` rather than from\n ``#/definitions/MiniProfile/user_name``.\n3. Example from primitive types.\n\n.. |Build Status| image:: https://travis-ci.org/Arello-Mobile/swagger2rst.svg?branch=master\n :target: https://travis-ci.org/Arello-Mobile/swagger2rst", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Arello-Mobile/swagger2rst", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "swagger2rst", "package_url": "https://pypi.org/project/swagger2rst/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/swagger2rst/", "project_urls": { "Homepage": "https://github.com/Arello-Mobile/swagger2rst" }, "release_url": "https://pypi.org/project/swagger2rst/0.0.4/", "requires_dist": [ "cached-property (>=1.3.0)", "Jinja2 (>=2.8)", "jsonschema (>=2.5.1)", "PyYAML (>=3.11)", "strict-rfc3339" ], "requires_python": "", "summary": "Tool for convert \"Swagger\" format file to \"Restructured text\"", "version": "0.0.4" }, "last_serial": 2343969, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "f5026510553200d193db2bbed9b22704", "sha256": "eba5654ca8820cc39cc212b607655b0f4735b8bd64f30f897e2992ee3f7fa762" }, "downloads": -1, "filename": "swagger2rst-0.0.2.tar.gz", "has_sig": false, "md5_digest": "f5026510553200d193db2bbed9b22704", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12714, "upload_time": "2015-11-12T08:40:06", "url": "https://files.pythonhosted.org/packages/33/28/11e4e93020af3aca0400a8e6c2383e33209a8fa137f99ee5d737dec5f045/swagger2rst-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "e86e289802ef2d5b7973388a7493a33e", "sha256": "3a03fa833cc22699c5f7e4c64a8497f868a8de41c9ab2a117b2b1f9025a21854" }, "downloads": -1, "filename": "swagger2rst-0.0.3.tar.gz", "has_sig": false, "md5_digest": "e86e289802ef2d5b7973388a7493a33e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14604, "upload_time": "2016-01-30T09:14:10", "url": "https://files.pythonhosted.org/packages/67/4d/4eaab2386887b838727d8b8ee806e3873b1d142bcf4285ab8ea4f4efec49/swagger2rst-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "d2c069d186dadc85c8b9ef99fd69fb4d", "sha256": "7bc4eb1d3a80b04e2db0afdc8669a5eb491003d88e5a34e784f7a90df734078a" }, "downloads": -1, "filename": "swagger2rst-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d2c069d186dadc85c8b9ef99fd69fb4d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 33442, "upload_time": "2016-09-15T10:42:07", "url": "https://files.pythonhosted.org/packages/7b/57/67a49b214f4f40bfaec8d825889cd38878ad16aa473e0767964bb442bbd4/swagger2rst-0.0.4-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d2c069d186dadc85c8b9ef99fd69fb4d", "sha256": "7bc4eb1d3a80b04e2db0afdc8669a5eb491003d88e5a34e784f7a90df734078a" }, "downloads": -1, "filename": "swagger2rst-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d2c069d186dadc85c8b9ef99fd69fb4d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 33442, "upload_time": "2016-09-15T10:42:07", "url": "https://files.pythonhosted.org/packages/7b/57/67a49b214f4f40bfaec8d825889cd38878ad16aa473e0767964bb442bbd4/swagger2rst-0.0.4-py2.py3-none-any.whl" } ] }