{ "info": { "author": "Alex Revin", "author_email": "lyssdod@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# djsw_wrapper\nMissing Swagger and Django tool.\n\n[![PyPI version](https://badge.fury.io/py/djsw_wrapper.svg)](https://badge.fury.io/py/djsw_wrapper)\n\n## What?\nSwagger/OpenAPI is an amazing thing. It allows you to describe your schema completely in yaml/json and have a number of backends which allow you to generate code for many frameworks and languages. Unfortunately, there were no options to use Swagger as a schema source if you develop your code using Django/DRF (however, the latter can generate Swagger schema from your current source). Until now!\n\n## Requirements\n`django`, `djangorestframework`, `jinja2`, `flex`\n\n## Okay, how do I shoot ~~the web~~ Swagger?\n* Get this package: `pip install djsw_wrapper`\n* Modify your django project's `settings.py`:\n```python\n...\n# Application definition\n\nINSTALLED_APPS = [\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.messages',\n 'django.contrib.staticfiles',\n 'rest_framework',\n 'djsw_wrapper', # << add this\n 'stubapp.apps.StubappConfig'\n]\n\n# This: full path to schema resource (local file or url, json or yaml)\nSWAGGER_SCHEMA = '/path/to/swagger/schema'\n\n# And this (optional, but recommended):\nSWAGGER_MODULE = 'swagger_controller_python_module_name'\n```\n\n* Add new url patterns to `urls.py`:\n```python\nfrom djsw_wrapper.router import SwaggerRouter\n\nrouter = SwaggerRouter()\n\nurlpatterns = router.get_urls() + [\n # ^^^^^^^^^^^^^^^^^^^ add this\n url(r'^admin/', admin.site.urls)\n]\n```\n\n* Basically, you're all set now. However, if you don't have any controllers (`views` in Django's terminology), you can generate code for them (need `SWAGGER_MODULE` setting populated):\n```shell\n$ python manage.py makeswaggerviews\n```\n\n* Go!\n```shell\n$ python manage.py runserver\n```\n\n## How does it work?\n\n#### 1. Schema parsing and route generation\nIt parses swagger schema and creates url patterns for each path described there. Next, each path is bound to the corresponding view (`controller` in Swagger's terminology). How this bounding happens? Firstly, it tries to import `SWAGGER_MODULE` module, specified in `settings.py`. If there's no such module or setting, stub handlers are autogenerated in runtime. If there is a module, tool looks into `x-swagger-router-controller` property in each path definition; if property is present and points to callable view in aforementioned `SWAGGER_MODULE` module, bounding happens. If not, stub is used.\n\n### 2. Request processing\nWhen request comes to a certain endpoint (`path`) and there's a suitable handler (`view`) for it, validation and serialization happens automatically. For example, if you specified some `parameter` for a `path` as `required` and it's not present in the request, client will get an error message. The same happens if there's type inconsistency (for example, you specified integer, but client sent string). If all is good, suitable handler (`view`) is executed (or stub handler, if bounding didn't happen).\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/ErintLabs/django-openapi-gen/archive/0.2.3.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ErintLabs/django-openapi-gen", "keywords": "django,swagger,schema,django-rest-framework", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "djsw_wrapper", "package_url": "https://pypi.org/project/djsw_wrapper/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/djsw_wrapper/", "project_urls": { "Download": "https://github.com/ErintLabs/django-openapi-gen/archive/0.2.3.1.tar.gz", "Homepage": "https://github.com/ErintLabs/django-openapi-gen" }, "release_url": "https://pypi.org/project/djsw_wrapper/0.2.3.1/", "requires_dist": null, "requires_python": null, "summary": "Allows to build REST API directly from Swagger schema", "version": "0.2.3.1" }, "last_serial": 2874011, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "504083cbc4afb03f183c69d200b1c7ed", "sha256": "1bfd312a81541fefe06f527bf24597434e102af42e5611a3c84b54fce6ff2f9f" }, "downloads": -1, "filename": "djsw_wrapper-0.1.1.tar.gz", "has_sig": false, "md5_digest": "504083cbc4afb03f183c69d200b1c7ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4649, "upload_time": "2017-03-03T16:01:32", "url": "https://files.pythonhosted.org/packages/31/9c/97546a6c367f0b136c00c73eb5903f99ca03784027711328aee3152a5cb2/djsw_wrapper-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "a4c98b14d87492c6b54aa67b4906fc3a", "sha256": "722e2d1eb7333e12dde2872750bef27e0e3fb3eae1c0d60e032c4c5f38653459" }, "downloads": -1, "filename": "djsw_wrapper-0.1.2.tar.gz", "has_sig": false, "md5_digest": "a4c98b14d87492c6b54aa67b4906fc3a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5538, "upload_time": "2017-03-14T00:48:37", "url": "https://files.pythonhosted.org/packages/d2/a7/e6f5818df6fa0d1a064894a8f0c2eb99a023467b6b4224ab2663b4f64252/djsw_wrapper-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "e074a968237b65e506e7b7e962f39b5c", "sha256": "ee79f16c39b7fa72ad40881fbc6fef566b857f8328c6feab866e03c946ae611b" }, "downloads": -1, "filename": "djsw_wrapper-0.1.3.tar.gz", "has_sig": false, "md5_digest": "e074a968237b65e506e7b7e962f39b5c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5777, "upload_time": "2017-03-14T16:17:54", "url": "https://files.pythonhosted.org/packages/83/be/f2c34c1801eca37096d72583eb85575fe812f16c89ed44c5e12e42a73e34/djsw_wrapper-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "31e0e9d491a65dcecb36af4e923c4f90", "sha256": "f583dcbe7e8cb396331da117c8cd807045c2604bfc4c2f44e5637bf72f48e3e8" }, "downloads": -1, "filename": "djsw_wrapper-0.1.4.tar.gz", "has_sig": false, "md5_digest": "31e0e9d491a65dcecb36af4e923c4f90", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5855, "upload_time": "2017-03-15T03:45:56", "url": "https://files.pythonhosted.org/packages/a0/f6/593781b2797e8f33d45fa4b2b10891d9b8574030d352c3462bfd424095b2/djsw_wrapper-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "58407b975b96f05ba503d0f2ba8e3e42", "sha256": "d4456627772fdb0b9d0e974d1e8df9615771c4c69a61197e53df6fe50e70c98b" }, "downloads": -1, "filename": "djsw_wrapper-0.1.5.tar.gz", "has_sig": false, "md5_digest": "58407b975b96f05ba503d0f2ba8e3e42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5941, "upload_time": "2017-03-16T12:46:22", "url": "https://files.pythonhosted.org/packages/92/13/7a24f5c1789a6232a0c2b5eae95d07989adaece713faa252d6b97d26e851/djsw_wrapper-0.1.5.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "223af4f94950fb1a5a9c775720e8fa33", "sha256": "c9679a9fa78f4eda82aa62c7ab4ed7045929ea7a77348582f3fc6ce35cc39d61" }, "downloads": -1, "filename": "djsw_wrapper-0.1.8.tar.gz", "has_sig": false, "md5_digest": "223af4f94950fb1a5a9c775720e8fa33", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9424, "upload_time": "2017-03-17T01:29:36", "url": "https://files.pythonhosted.org/packages/ec/f8/abbcaabcd8f8b89dc225871c55b6b59525177555b457d34f6c9c09361182/djsw_wrapper-0.1.8.tar.gz" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "d60aae82decb46b9c18cac059f603d66", "sha256": "5121e0748f94343555f293ddbefb9ad7e278579c0a4acbac22e9fab721adf693" }, "downloads": -1, "filename": "djsw_wrapper-0.1.9.tar.gz", "has_sig": false, "md5_digest": "d60aae82decb46b9c18cac059f603d66", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9424, "upload_time": "2017-03-17T23:43:33", "url": "https://files.pythonhosted.org/packages/f9/8b/eb55ce90329f81519f047b186a5db0f7090721a824e701773708eca6fd72/djsw_wrapper-0.1.9.tar.gz" } ], "0.1.9.6": [ { "comment_text": "", "digests": { "md5": "b20ba5e6b3658f195834e2b0422ef9d0", "sha256": "efec43ec499e4ee609182800edf54cdd1b580ed5cb9ea27b1790eef2032ec248" }, "downloads": -1, "filename": "djsw_wrapper-0.1.9.6.tar.gz", "has_sig": false, "md5_digest": "b20ba5e6b3658f195834e2b0422ef9d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9580, "upload_time": "2017-03-20T13:04:08", "url": "https://files.pythonhosted.org/packages/97/ac/694340a2a1d495b85c004570233460101416f041156fe9aee4e8552101e9/djsw_wrapper-0.1.9.6.tar.gz" } ], "0.1.9.7": [ { "comment_text": "", "digests": { "md5": "a9cea4c246aa460b48b82d53a30c6a0b", "sha256": "2d3f58f3edd8b3bec8caf740a4e1118369246afd8a27a7e8e1266da334cbf2d8" }, "downloads": -1, "filename": "djsw_wrapper-0.1.9.7.tar.gz", "has_sig": false, "md5_digest": "a9cea4c246aa460b48b82d53a30c6a0b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9578, "upload_time": "2017-03-20T13:08:06", "url": "https://files.pythonhosted.org/packages/18/e9/f8219d55e216d3e0b45ccb8d97909058f2f17337bfc7ee13c6420c85e8a2/djsw_wrapper-0.1.9.7.tar.gz" } ], "0.1.9.8": [ { "comment_text": "", "digests": { "md5": "7de3e778e93f7675d4ae53c5ba5776da", "sha256": "053ea258d7710494edda44705f9e165dec1084792dd5f6ff1ccb63a6677cc750" }, "downloads": -1, "filename": "djsw_wrapper-0.1.9.8.tar.gz", "has_sig": false, "md5_digest": "7de3e778e93f7675d4ae53c5ba5776da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9578, "upload_time": "2017-03-20T13:35:53", "url": "https://files.pythonhosted.org/packages/f5/9a/624ca8102d1970babbba2adb27956474b1860b2d1b3b5a5a4a1f93c1bdb1/djsw_wrapper-0.1.9.8.tar.gz" } ], "0.1.9.9": [ { "comment_text": "", "digests": { "md5": "a965097c6be66f65232c5fc0823e5ce5", "sha256": "a038584a49767ac78615fac30c8387e13b447be3f621eaaee34b45d083601eca" }, "downloads": -1, "filename": "djsw_wrapper-0.1.9.9.tar.gz", "has_sig": false, "md5_digest": "a965097c6be66f65232c5fc0823e5ce5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11116, "upload_time": "2017-03-23T13:38:52", "url": "https://files.pythonhosted.org/packages/6e/d7/0ac30c9bfb4eec1ea411728b3ebbe46aca4693dcab073a27b1ddbaccf9eb/djsw_wrapper-0.1.9.9.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "b0293daff455fe127d495d5593c6d6e7", "sha256": "99ebdb40b4f9db7d36aeb006ad1b36b0e98846fdb46c2d390f8413fac2f3a3d3" }, "downloads": -1, "filename": "djsw_wrapper-0.2.0.tar.gz", "has_sig": false, "md5_digest": "b0293daff455fe127d495d5593c6d6e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11420, "upload_time": "2017-03-23T16:17:53", "url": "https://files.pythonhosted.org/packages/50/f3/3e5667dc367d9ad1b389fbbe0de9ca6e51cc78139ce138d02b3fccd78dba/djsw_wrapper-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "2df3e5f8b761bdf40ca7be48fed49c6c", "sha256": "ce7fbc2e2a230d78f8efb379eee16bc1a8932831a5b2087c9e8af75fea90b133" }, "downloads": -1, "filename": "djsw_wrapper-0.2.1.tar.gz", "has_sig": false, "md5_digest": "2df3e5f8b761bdf40ca7be48fed49c6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11956, "upload_time": "2017-03-25T02:39:45", "url": "https://files.pythonhosted.org/packages/4e/41/b8764d0c902acb5aec98d708b80ab80d6dd9757d1a36d20acf0d8c0c9785/djsw_wrapper-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "83485d180e328d82d9c7eb7f04c81831", "sha256": "4b58258f8c996b6d5c1e2031caa86f8b1ea12a4708a59fb456841ddebec0cfdd" }, "downloads": -1, "filename": "djsw_wrapper-0.2.2.tar.gz", "has_sig": false, "md5_digest": "83485d180e328d82d9c7eb7f04c81831", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12193, "upload_time": "2017-03-29T00:30:43", "url": "https://files.pythonhosted.org/packages/ef/73/95dc58cb579851f4fa0f1e5e9bffd59c0d815c3afefa7c660c0279e23a36/djsw_wrapper-0.2.2.tar.gz" } ], "0.2.2.1": [ { "comment_text": "", "digests": { "md5": "326a9bd04996ad7eb8ff30edd77b8263", "sha256": "b592e0a4f6608b97d8886ae58646b46e32772cd774e1fda158ee9d786be8ff1f" }, "downloads": -1, "filename": "djsw_wrapper-0.2.2.1.tar.gz", "has_sig": false, "md5_digest": "326a9bd04996ad7eb8ff30edd77b8263", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12191, "upload_time": "2017-03-29T01:07:44", "url": "https://files.pythonhosted.org/packages/df/10/5a12d4e7b675c21ee31b3d7ff15426c2464ac9b3aca63efc17d06c8ee698/djsw_wrapper-0.2.2.1.tar.gz" } ], "0.2.2.2": [ { "comment_text": "", "digests": { "md5": "957e904ad2de354355d76b96b3f01fcd", "sha256": "1578539d84cc6d118c58803e7b9c84578399591c73a6ba4bf3aade082b51085e" }, "downloads": -1, "filename": "djsw_wrapper-0.2.2.2.tar.gz", "has_sig": false, "md5_digest": "957e904ad2de354355d76b96b3f01fcd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12567, "upload_time": "2017-03-29T02:12:46", "url": "https://files.pythonhosted.org/packages/e8/60/a2bf5575a380c67d2b27d816ecc9792bf291f8df969560ad953a2ff093f7/djsw_wrapper-0.2.2.2.tar.gz" } ], "0.2.2.3": [ { "comment_text": "", "digests": { "md5": "af161a00a7d249c50b1c5c5ff98415d0", "sha256": "5f2816592e121cbaf9f8a3b191090cd1eedc4bc1b94d9357d71524cc81ebb501" }, "downloads": -1, "filename": "djsw_wrapper-0.2.2.3.tar.gz", "has_sig": false, "md5_digest": "af161a00a7d249c50b1c5c5ff98415d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12584, "upload_time": "2017-03-29T02:25:03", "url": "https://files.pythonhosted.org/packages/1e/c7/a273b11199b53c574c54aef0a3da667604a646bde3344e63b4e44ca18416/djsw_wrapper-0.2.2.3.tar.gz" } ], "0.2.2.4": [ { "comment_text": "", "digests": { "md5": "043e9f090668c8bd6fc6782932410d57", "sha256": "678428687f2c96d13d30d29e9b849aa763a6eeadcd379deb467ac60f8f01258e" }, "downloads": -1, "filename": "djsw_wrapper-0.2.2.4.tar.gz", "has_sig": false, "md5_digest": "043e9f090668c8bd6fc6782932410d57", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12810, "upload_time": "2017-03-29T02:51:32", "url": "https://files.pythonhosted.org/packages/16/78/fd2d3baf79cb69f3430d3ce14c7211b75b6bae47dfd6d63c30237b3db5ed/djsw_wrapper-0.2.2.4.tar.gz" } ], "0.2.2.5": [ { "comment_text": "", "digests": { "md5": "4b3d1bc36c015b335e99d94e3dea71e1", "sha256": "f8eabe85cb6cf2a23f51e6b00d646508f830b0bf82505a49f9feeb5d74aa72e9" }, "downloads": -1, "filename": "djsw_wrapper-0.2.2.5.tar.gz", "has_sig": false, "md5_digest": "4b3d1bc36c015b335e99d94e3dea71e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12861, "upload_time": "2017-03-29T03:08:29", "url": "https://files.pythonhosted.org/packages/86/76/468155d5a675e1ae1e72bbf84e9c8f2a42cb513c9a95e750a539b8c6c67d/djsw_wrapper-0.2.2.5.tar.gz" } ], "0.2.2.6": [ { "comment_text": "", "digests": { "md5": "00efa58592ef3a627a2c4b00372a4862", "sha256": "7da3cf254570458399c9c9308e1665d4483b94712bf94b63ffb0c7a3ce2fd5f4" }, "downloads": -1, "filename": "djsw_wrapper-0.2.2.6.tar.gz", "has_sig": false, "md5_digest": "00efa58592ef3a627a2c4b00372a4862", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12867, "upload_time": "2017-03-29T03:21:21", "url": "https://files.pythonhosted.org/packages/5e/4c/7289429798952c9b474e7c5cea64812c736e529c59624f68290df4f5ffe8/djsw_wrapper-0.2.2.6.tar.gz" } ], "0.2.2.7": [ { "comment_text": "", "digests": { "md5": "6287b3dae90a536e31b76c3ff9cfa9e7", "sha256": "b5f88fe24a3687163ce162f62df0f11704c5f647983cc2487fc820ec359eadb7" }, "downloads": -1, "filename": "djsw_wrapper-0.2.2.7.tar.gz", "has_sig": false, "md5_digest": "6287b3dae90a536e31b76c3ff9cfa9e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12877, "upload_time": "2017-03-29T04:25:39", "url": "https://files.pythonhosted.org/packages/31/9e/7a17d9336d342d1d9be7a77867f3592dafffcedbe734da9544339484080c/djsw_wrapper-0.2.2.7.tar.gz" } ], "0.2.2.8": [ { "comment_text": "", "digests": { "md5": "fe950b6ddc6db62bc4e022bfd8579e8c", "sha256": "84bccbb9ece68b0c62f4c194844ececcd55a49efdbbb87c3809393e59949bf47" }, "downloads": -1, "filename": "djsw_wrapper-0.2.2.8.tar.gz", "has_sig": false, "md5_digest": "fe950b6ddc6db62bc4e022bfd8579e8c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12672, "upload_time": "2017-03-30T00:18:47", "url": "https://files.pythonhosted.org/packages/32/ef/542ff70e3b83dd6217e268e795132c8c914467e219ae2f39c05f03453458/djsw_wrapper-0.2.2.8.tar.gz" } ], "0.2.2.9": [ { "comment_text": "", "digests": { "md5": "fccea6ca0140a761ac2b8f9ac201e96c", "sha256": "07a43a6bb55d1fefbb5aaaca9eaeb5b8f793f0720333bd6c394398b3b2444f81" }, "downloads": -1, "filename": "djsw_wrapper-0.2.2.9.tar.gz", "has_sig": false, "md5_digest": "fccea6ca0140a761ac2b8f9ac201e96c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12689, "upload_time": "2017-04-09T16:32:37", "url": "https://files.pythonhosted.org/packages/2e/c7/00f72a21840d11600cac1e5a62ac72cd867d4f1b8ab010ebc4a8a1b765c8/djsw_wrapper-0.2.2.9.tar.gz" } ], "0.2.3.0": [ { "comment_text": "", "digests": { "md5": "f7ea35f2639435daa3da8783d9b8f577", "sha256": "fc94eceea03bd15c8f3fbd62c84d4e509c21334c6685746c4a0efe8494329662" }, "downloads": -1, "filename": "djsw_wrapper-0.2.3.0.tar.gz", "has_sig": false, "md5_digest": "f7ea35f2639435daa3da8783d9b8f577", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12692, "upload_time": "2017-04-10T02:43:20", "url": "https://files.pythonhosted.org/packages/ed/e7/1f673a0e0e0c7629b523ff478e238746bc184127bec2125b36a96af990f8/djsw_wrapper-0.2.3.0.tar.gz" } ], "0.2.3.1": [ { "comment_text": "", "digests": { "md5": "a54a6cb1f09b3b27e0304138d64bd2eb", "sha256": "cd6253db81ae2682e169b87e3737496599527bb12155c612c243730b11b829d7" }, "downloads": -1, "filename": "djsw_wrapper-0.2.3.1.tar.gz", "has_sig": false, "md5_digest": "a54a6cb1f09b3b27e0304138d64bd2eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12694, "upload_time": "2017-05-14T21:05:31", "url": "https://files.pythonhosted.org/packages/fa/43/c026133decb4c8d79aeee5d4edb0bec2f708db3af636188d107de73fe3f9/djsw_wrapper-0.2.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a54a6cb1f09b3b27e0304138d64bd2eb", "sha256": "cd6253db81ae2682e169b87e3737496599527bb12155c612c243730b11b829d7" }, "downloads": -1, "filename": "djsw_wrapper-0.2.3.1.tar.gz", "has_sig": false, "md5_digest": "a54a6cb1f09b3b27e0304138d64bd2eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12694, "upload_time": "2017-05-14T21:05:31", "url": "https://files.pythonhosted.org/packages/fa/43/c026133decb4c8d79aeee5d4edb0bec2f708db3af636188d107de73fe3f9/djsw_wrapper-0.2.3.1.tar.gz" } ] }