{ "info": { "author": "podhmo", "author_email": "ababjam61@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Programming Language :: Python :: Implementation :: CPython" ], "description": "pyramid-swagger-router\n========================================\n\nview's code generation from a swagger's definition file.\n\n\nmotiviation\n----------------------------------------\n\nthis package's motivation is below.\n\n Code generation is better than meta-programming, and onetime scaffold is simply bad.\n\n\nCode generation is better than meta-programming\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nRational:\n\n- Reading generated code is more easier than reading meta-programming code\n- If you want to stop the code generation, just stop it (stopping using code generation is more easier than stopping meta-programming)\n\nOnetime scaffold is simply bad\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nOnetime scaffold (like a cookiecutter) is good for first creation. But, after scaffold implementation is changed, the migration about past generated code, handling manually(by yourself). So, this is bad.\n\nIt is ok, pyramid-swagger-router command called multiple times(because of merging code via FST(full syntax tree) (thunks to `redbaron `_)).\n\nWhere is the Router?\n----------------------------------------\n\nNothing. This is the code generation tool for routing setting(including view configuration).\n\nHow to use\n----------------------------------------\n\nHow to use this.\n\n.. code-block:: bash\n\n $ pip install pyramid-swagger-router\n $ pyramid-swagger-router \n\n\nif you passing swagger.yaml such as below.\n\n.. code-block:: yaml\n\n swagger: '2.0'\n info:\n title: Pet Shop Example API\n version: \"0.1\"\n consumes:\n - app.pet.views.ication/json\n produces:\n - app.pet.views.ication/json\n paths:\n /pets:\n x-pyramid-route-name: pets\n get:\n tags: [Pets]\n operationId: app.pet.views.get_pets\n summary: Get all pets\n parameters:\n - name: animal_type\n in: query\n type: string\n pattern: \"^[a-zA-Z0-9]*$\"\n - name: limit\n in: query\n type: integer\n minimum: 0\n default: 100\n responses:\n 200:\n description: Return pets\n schema:\n type: array\n items:\n $ref: '#/definitions/Pet'\n /pets/{pet_id}:\n x-pyramid-route-name: pet\n get:\n tags: [Pets]\n operationId: app.pet.views.get_pet\n summary: Get a single pet\n parameters:\n - $ref: '#/parameters/pet_id'\n responses:\n 200:\n description: Return pet\n schema:\n $ref: '#/definitions/Pet'\n 404:\n description: Pet does not exist\n put:\n tags: [Pets]\n operationId: app.pet.views.put_pet\n summary: Create or update a pet\n parameters:\n - $ref: '#/parameters/pet_id'\n - name: pet\n in: body\n schema:\n $ref: '#/definitions/Pet'\n responses:\n 200:\n description: Pet updated\n 201:\n description: New pet created\n delete:\n tags: [Pets]\n operationId: app.pet.views.delete_pet\n summary: Remove a pet\n parameters:\n - $ref: '#/parameters/pet_id'\n responses:\n 204:\n description: Pet was deleted\n 404:\n description: Pet does not exist\n\n\n parameters:\n pet_id:\n name: pet_id\n description: Pet's Unique identifier\n in: path\n type: string\n required: true\n pattern: \"^[a-zA-Z0-9-]+$\"\n\n definitions:\n Pet:\n type: object\n required:\n - name\n - animal_type\n properties:\n id:\n type: string\n description: Unique identifier\n example: \"123\"\n readOnly: true\n name:\n type: string\n description: Pet's name\n example: \"Susie\"\n minLength: 1\n maxLength: 100\n animal_type:\n type: string\n description: Kind of animal\n example: \"cat\"\n minLength: 1\n tags:\n type: object\n description: Custom tags\n created:\n type: string\n format: date-time\n description: Creation time\n example: \"2015-07-07T15:49:51.230+02:00\"\n readOnly: true\n\noutput code are like these.\n\napp/pet/__init__.py\n\n.. code-block:: python\n\n def includeme_swagger_router(config):\n config.add_route('pets', '/pets')\n config.add_route('pet', '/pets/{pet_id}')\n config.scan('.views')\n\n\n def includeme(config):\n config.include(includeme_swagger_router)\n\n\napp/pet/views.py\n\n.. code-block:: python\n\n from pyramid.view import(\n view_config\n )\n\n\n @view_config(renderer='json', request_method='GET', route_name='pets')\n def get_pets(context, request):\n \"\"\"\n Get all pets\n\n request.GET:\n\n * 'animal_type' - `{\"type\": \"string\", \"pattern\": \"^[a-zA-Z0-9]*$\"}`\n * 'limit' - `{\"type\": \"integer\", \"minimum\": 0, \"default\": 100}`\n \"\"\"\n return {}\n\n\n @view_config(renderer='json', request_method='GET', route_name='pet')\n def get_pet(context, request):\n \"\"\"\n Get a single pet\n\n request.matchdict:\n\n * 'pet_id' Pet's Unique identifier `{\"type\": \"string\", \"required\": true, \"pattern\": \"^[a-zA-Z0-9-]+$\"}`\n \"\"\"\n return {}\n\n\n @view_config(renderer='json', request_method='PUT', route_name='pet')\n def put_pet(context, request):\n \"\"\"\n Create or update a pet\n\n request.matchdict:\n\n * 'pet_id' Pet's Unique identifier `{\"type\": \"string\", \"required\": true, \"pattern\": \"^[a-zA-Z0-9-]+$\"}`\n\n request.json_body:\n\n ```\n {\n \"type\": \"object\",\n \"required\": [\n \"name\",\n \"animal_type\"\n ],\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"Unique identifier\",\n \"example\": \"123\",\n \"readOnly\": true\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"Pet's name\",\n \"example\": \"Susie\",\n \"minLength\": 1,\n \"maxLength\": 100\n },\n \"animal_type\": {\n \"type\": \"string\",\n \"description\": \"Kind of animal\",\n \"example\": \"cat\",\n \"minLength\": 1\n },\n \"tags\": {\n \"type\": \"object\",\n \"description\": \"Custom tags\"\n },\n \"created\": {\n \"type\": \"string\",\n \"format\": \"date-time\",\n \"description\": \"Creation time\",\n \"example\": \"2015-07-07T15:49:51.230+02:00\",\n \"readOnly\": true\n }\n }\n }\n ```\n \"\"\"\n return {}\n\n\n @view_config(renderer='json', request_method='DELETE', route_name='pet')\n def delete_pet(context, request):\n \"\"\"\n Remove a pet\n\n request.matchdict:\n\n * 'pet_id' Pet's Unique identifier `{\"type\": \"string\", \"required\": true, \"pattern\": \"^[a-zA-Z0-9-]+$\"}`\n \"\"\"\n return {}\n\nappendix 1\n----------------------------------------\n\nif you want to set custom route_name, using `x-pyramid-route-name`.\n\nappendix 2\n----------------------------------------\n\nWhen desrialization from json request, `swagger-marshmallow-codegen `_ is helpful, maybe.\n\n\n0.1.3\n\n- fix paths level's paramaters are not existed in docstring\n\n0.1.2\n\n- fix merge detection bug\n- fix error is occured when including parameters in methods section\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/podhmo/pyramid-swagger-router", "keywords": "swagger", "license": "", "maintainer": "", "maintainer_email": "", "name": "pyramid-swagger-router", "package_url": "https://pypi.org/project/pyramid-swagger-router/", "platform": "", "project_url": "https://pypi.org/project/pyramid-swagger-router/", "project_urls": { "Homepage": "https://github.com/podhmo/pyramid-swagger-router" }, "release_url": "https://pypi.org/project/pyramid-swagger-router/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "view's code generation from a swagger's definition file.", "version": "0.1.3" }, "last_serial": 2716084, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "ed6ed7fc96e136e3d7ca5af04f97a602", "sha256": "472f771cc55bed53d64e0064d608ac2d1160bed944bcaf71eea1985c8477522a" }, "downloads": -1, "filename": "pyramid_swagger_router-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ed6ed7fc96e136e3d7ca5af04f97a602", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 13478, "upload_time": "2017-01-03T13:42:24", "url": "https://files.pythonhosted.org/packages/1e/c4/e0d9dfb0d31551729b3d3930e54265b88ee4c5546b8bd12d912eb6ec4de6/pyramid_swagger_router-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2aa92c56f0ca61f4be77c644573a4ebf", "sha256": "858778d5edc89fe425787fe382583f206a3cb8acd92e220cd08be47f6b20b1cc" }, "downloads": -1, "filename": "pyramid-swagger-router-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2aa92c56f0ca61f4be77c644573a4ebf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10837, "upload_time": "2017-01-03T13:42:21", "url": "https://files.pythonhosted.org/packages/d1/e5/b224bb7d14385fa26e67f374bb1521152fa299ce1b2eb336d6c61b912160/pyramid-swagger-router-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "a8bb391609a0ae8e9f3e56387607014b", "sha256": "5bcdce7136720516b1c104ca59a49c97ced07786ccc0d9797a0d86a7e53e040d" }, "downloads": -1, "filename": "pyramid_swagger_router-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a8bb391609a0ae8e9f3e56387607014b", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 13735, "upload_time": "2017-03-19T17:23:52", "url": "https://files.pythonhosted.org/packages/33/23/7fb2004f81c3e92b6c1902b1c8dad994fe0e66108fd003ff818502b53a86/pyramid_swagger_router-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b9b6b9c3c27dbdee3c99908a6bf34bb8", "sha256": "09d9126b82da2c8e5d6836d23c16ab8f1bc478a94e02505cb338fb49436e8e13" }, "downloads": -1, "filename": "pyramid-swagger-router-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b9b6b9c3c27dbdee3c99908a6bf34bb8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11148, "upload_time": "2017-03-19T17:23:49", "url": "https://files.pythonhosted.org/packages/d7/e2/2985bc61257b86b35f9e2e4a03baf5520d8ea2e25edf11f44e7cec1eb821/pyramid-swagger-router-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "9b62c2ae9991ce2dcc4e878681390e95", "sha256": "7feea9d6f7e5a227c9a4b7f6a36485be7df990b4c3d4989ea5ff3a4e82351a30" }, "downloads": -1, "filename": "pyramid_swagger_router-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9b62c2ae9991ce2dcc4e878681390e95", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 13842, "upload_time": "2017-03-19T17:41:13", "url": "https://files.pythonhosted.org/packages/e7/fa/a1142539226195c0a89e4b3fbfb99e1bc91f5c45fc62f5a7a7c407aba98f/pyramid_swagger_router-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "911ae2bad54db5b99ac225da596c6563", "sha256": "2bd01b38de43469a3ff7171cf3469111f24bc08f8e8660e094f5fb8776fc556b" }, "downloads": -1, "filename": "pyramid-swagger-router-0.1.3.tar.gz", "has_sig": false, "md5_digest": "911ae2bad54db5b99ac225da596c6563", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11237, "upload_time": "2017-03-19T17:41:10", "url": "https://files.pythonhosted.org/packages/ab/3b/7dc8e31e74bca06b4e21f1f8f43617d8ec9a253bc7fee5ae85241fedf1e7/pyramid-swagger-router-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9b62c2ae9991ce2dcc4e878681390e95", "sha256": "7feea9d6f7e5a227c9a4b7f6a36485be7df990b4c3d4989ea5ff3a4e82351a30" }, "downloads": -1, "filename": "pyramid_swagger_router-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9b62c2ae9991ce2dcc4e878681390e95", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 13842, "upload_time": "2017-03-19T17:41:13", "url": "https://files.pythonhosted.org/packages/e7/fa/a1142539226195c0a89e4b3fbfb99e1bc91f5c45fc62f5a7a7c407aba98f/pyramid_swagger_router-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "911ae2bad54db5b99ac225da596c6563", "sha256": "2bd01b38de43469a3ff7171cf3469111f24bc08f8e8660e094f5fb8776fc556b" }, "downloads": -1, "filename": "pyramid-swagger-router-0.1.3.tar.gz", "has_sig": false, "md5_digest": "911ae2bad54db5b99ac225da596c6563", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11237, "upload_time": "2017-03-19T17:41:10", "url": "https://files.pythonhosted.org/packages/ab/3b/7dc8e31e74bca06b4e21f1f8f43617d8ec9a253bc7fee5ae85241fedf1e7/pyramid-swagger-router-0.1.3.tar.gz" } ] }