{"id":13595177,"url":"https://github.com/plangrid/flask-rebar","last_synced_at":"2026-01-18T01:52:39.790Z","repository":{"id":37270013,"uuid":"123005291","full_name":"plangrid/flask-rebar","owner":"plangrid","description":"Flask-Rebar combines flask, marshmallow, and swagger for robust REST services.","archived":false,"fork":false,"pushed_at":"2024-10-10T17:58:11.000Z","size":9607,"stargazers_count":233,"open_issues_count":49,"forks_count":38,"subscribers_count":121,"default_branch":"master","last_synced_at":"2024-11-14T13:52:51.501Z","etag":null,"topics":["acsbp","public"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plangrid.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-26T17:39:13.000Z","updated_at":"2024-10-28T23:51:57.000Z","dependencies_parsed_at":"2023-09-26T00:46:50.864Z","dependency_job_id":"4aeb2333-c80d-46af-bdf3-36a12742e926","html_url":"https://github.com/plangrid/flask-rebar","commit_stats":{"total_commits":303,"total_committers":42,"mean_commits":7.214285714285714,"dds":0.7755775577557755,"last_synced_commit":"cdb2c0c927f139806d1f6b43415f062d082d5cff"},"previous_names":[],"tags_count":58,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plangrid%2Fflask-rebar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plangrid%2Fflask-rebar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plangrid%2Fflask-rebar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plangrid%2Fflask-rebar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plangrid","download_url":"https://codeload.github.com/plangrid/flask-rebar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248020593,"owners_count":21034459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acsbp","public"],"created_at":"2024-08-01T16:01:45.368Z","updated_at":"2026-01-18T01:52:39.752Z","avatar_url":"https://github.com/plangrid.png","language":"Python","funding_links":[],"categories":["Python","Third-Party Extensions","Flask Utilities","Extensions"],"sub_categories":["APIs"],"readme":"Flask-Rebar\n===========\n\n.. image:: https://readthedocs.org/projects/flask-rebar/badge/?version=latest\n   :target: http://flask-rebar.readthedocs.io/en/latest/?badge=latest\n   :alt: Documentation Status\n\n.. image:: https://github.com/plangrid/flask-rebar/actions/workflows/tag.yml/badge.svg\n   :target: https://github.com/plangrid/flask-rebar/actions/workflows/tag.yml\n   :alt: CI Status\n\n.. image:: https://badge.fury.io/py/flask-rebar.svg\n   :target: https://badge.fury.io/py/flask-rebar\n   :alt: PyPI status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/ambv/black\n   :alt: Code style\n\n.. image:: https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg\n   :target: https://www.contributor-covenant.org/\n   :alt: Code of Conduct\n\n|\n\nFlask-Rebar combines `flask \u003chttp://flask.pocoo.org/\u003e`_, `marshmallow \u003chttps://marshmallow.readthedocs.io/en/latest/\u003e`_, and `swagger \u003chttps://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md\u003e`_ for robust REST services.\n\n\nFeatures\n--------\n\n* **Request and Response Validation** - Flask-Rebar relies on schemas from the popular Marshmallow package to validate incoming requests and marshal outgoing responses.\n* **Automatic Swagger Generation** - The same schemas used for validation and marshaling are used to automatically generate OpenAPI specifications (a.k.a. Swagger). This also means automatic documentation via `Swagger UI \u003chttps://swagger.io/swagger-ui/\u003e`_.\n* **Error Handling** - Uncaught exceptions from Flask-Rebar are converted to appropriate HTTP errors.\n\n\nExample\n-------\n\n.. code-block:: python\n\n   from flask import Flask\n   from flask_rebar import errors, Rebar\n   from marshmallow import fields, Schema\n\n   from my_app import database\n\n\n   rebar = Rebar()\n\n   # All handler URL rules will be prefixed by '/v1'\n   registry = rebar.create_handler_registry(prefix='/v1')\n\n   class TodoSchema(Schema):\n       id = fields.Integer()\n       complete = fields.Boolean()\n       description = fields.String()\n\n   # This schema will validate the incoming request's query string\n   class GetTodosQueryStringSchema(Schema):\n       complete = fields.Boolean()\n\n   # This schema will marshal the outgoing response\n   class GetTodosResponseSchema(Schema):\n       data = fields.Nested(TodoSchema, many=True)\n\n\n   @registry.handles(\n       rule='/todos',\n       method='GET',\n       query_string_schema=GetTodosQueryStringSchema(),\n       response_body_schema=GetTodosResponseSchema(), # for versions \u003c= 1.7.0, use marshal_schema\n   )\n   def get_todos():\n       \"\"\"\n       This docstring will be rendered as the operation's description in\n       the auto-generated OpenAPI specification.\n       \"\"\"\n       # The query string has already been validated by `query_string_schema`\n       complete = rebar.validated_args.get('complete')\n\n       ...\n\n       # Errors are converted to appropriate HTTP errors\n       raise errors.Forbidden()\n\n       ...\n\n       # The response will be marshaled by `marshal_schema`\n       return {'data': []}\n\n\n   def create_app(name):\n       app = Flask(name)\n       rebar.init_app(app)\n       return app\n\n\n   if __name__ == '__main__':\n       create_app(__name__).run()\n\n\nFor a more complete example, check out the example app at `examples/todo.py \u003cexamples/todo/todo.py\u003e`_. Some example requests to this example app can be found at `examples/todo_output.md \u003cexamples/todo/todo_output.md\u003e`_.\n\n\nInstallation\n------------\n\n.. code-block::\n\n   pip install flask-rebar\n\n\nReplacing static swagger-ui files\n---------------------------------\n\nIf you'd like to replace swagger-ui's static files (`flask_rebar/swagger_ui/static`) with those of the latest release,\nrun the following from the root of the project.\n\n.. code-block::\n    \n    curl -L https://api.github.com/repos/swagger-api/swagger-ui/tarball | tar -xv --directory=flask_rebar/swagger_ui/static --strip-components=2 \"*/dist/\"\n\nDocumentation\n-------------\n\nMore extensive documentation can be found  `here \u003chttps://flask-rebar.readthedocs.io\u003e`_.\n\n\nExtensions\n----------\n\nFlask-Rebar is extensible! Here are some open source extensions:\n\n* `Flask-Rebar-Auth0 \u003chttps://github.com/Sytten/flask-rebar-auth0\u003e`_ - `Auth0 \u003chttps://auth0.com/\u003e`_ authenticator for Flask-Rebar\n\n\nContributing\n------------\n\nThere is still work to be done, and contributions are encouraged! Check out the `contribution guide \u003cCONTRIBUTING.rst\u003e`_ for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplangrid%2Fflask-rebar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplangrid%2Fflask-rebar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplangrid%2Fflask-rebar/lists"}