{"id":14065176,"url":"https://github.com/luolingchun/flask-openapi3","last_synced_at":"2025-10-07T01:56:46.446Z","repository":{"id":38388378,"uuid":"362315893","full_name":"luolingchun/flask-openapi3","owner":"luolingchun","description":"Generate REST API and OpenAPI documentation for your Flask project.","archived":false,"fork":false,"pushed_at":"2025-09-20T03:00:12.000Z","size":10280,"stargazers_count":242,"open_issues_count":19,"forks_count":41,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-04T20:18:30.780Z","etag":null,"topics":["flask","flask-openapi3","openapi","openapi3","pydantic","python","python3","rapidoc","redoc","rest","swagger","swagger-ui"],"latest_commit_sha":null,"homepage":"https://luolingchun.github.io/flask-openapi3/","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/luolingchun.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.rst","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-28T02:39:57.000Z","updated_at":"2025-10-04T14:24:42.000Z","dependencies_parsed_at":"2023-10-03T10:49:57.731Z","dependency_job_id":"59dd387b-453c-4fee-9cbc-e548efcf6060","html_url":"https://github.com/luolingchun/flask-openapi3","commit_stats":{"total_commits":289,"total_committers":6,"mean_commits":"48.166666666666664","dds":0.03806228373702425,"last_synced_commit":"19a6f75ebb0cf89289e44562b5a7e1bd27ea3e54"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"purl":"pkg:github/luolingchun/flask-openapi3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luolingchun%2Fflask-openapi3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luolingchun%2Fflask-openapi3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luolingchun%2Fflask-openapi3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luolingchun%2Fflask-openapi3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luolingchun","download_url":"https://codeload.github.com/luolingchun/flask-openapi3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luolingchun%2Fflask-openapi3/sbom","scorecard":{"id":339523,"data":{"date":"2025-08-11","repo":{"name":"github.com/luolingchun/flask-openapi3","commit":"baea24210dd36c08f46030b5276eaf43703ad9d1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5,"checks":[{"name":"Code-Review","score":3,"reason":"Found 10/29 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":9,"reason":"9 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/docs.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Warn: no topLevel permission defined: .github/workflows/stale.yml:1","Warn: no topLevel permission defined: .github/workflows/tests.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/luolingchun/flask-openapi3/docs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/luolingchun/flask-openapi3/docs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/luolingchun/flask-openapi3/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/luolingchun/flask-openapi3/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/stale.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/luolingchun/flask-openapi3/stale.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/luolingchun/flask-openapi3/tests.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/luolingchun/flask-openapi3/tests.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/luolingchun/flask-openapi3/tests.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/docs.yml:34","Warn: pipCommand not pinned by hash: .github/workflows/publish.yml:23","Warn: pipCommand not pinned by hash: .github/workflows/publish.yml:24","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:43","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:44","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:45","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:46","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:47","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:48","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:49","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of  10 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.rst:0","Info: FSF or OSI recognized license: MIT License: LICENSE.rst:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T05:27:37.481Z","repository_id":38388378,"created_at":"2025-08-18T05:27:37.481Z","updated_at":"2025-08-18T05:27:37.481Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278551493,"owners_count":26005388,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["flask","flask-openapi3","openapi","openapi3","pydantic","python","python3","rapidoc","redoc","rest","swagger","swagger-ui"],"created_at":"2024-08-13T07:04:20.965Z","updated_at":"2025-10-07T01:56:46.422Z","avatar_url":"https://github.com/luolingchun.png","language":"Python","readme":"\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://luolingchun.github.io/flask-openapi3/\" target=\"_blank\"\u003e\n        \u003cimg class=\"off-glb\" src=\"https://raw.githubusercontent.com/luolingchun/flask-openapi3/master/docs/images/logo-text.svg\" \n             width=\"60%\" height=\"auto\" alt=\"logo\"\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\u003cp align=\"center\"\u003e\n    \u003cem\u003eGenerate REST API and OpenAPI documentation for your Flask project.\u003c/em\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/luolingchun/flask-openapi3/actions/workflows/tests.yml\" target=\"_blank\"\u003e\n        \u003cimg class=\"off-glb\" src=\"https://img.shields.io/github/actions/workflow/status/luolingchun/flask-openapi3/tests.yml?branch=master\" alt=\"test\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/flask-openapi3/\" target=\"_blank\"\u003e\n        \u003cimg class=\"off-glb\" src=\"https://img.shields.io/pypi/v/flask-openapi3\" alt=\"pypi\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypistats.org/packages/flask-openapi3\" target=\"_blank\"\u003e\n        \u003cimg class=\"off-glb\" src=\"https://img.shields.io/pypi/dm/flask-openapi3\" alt=\"pypistats\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/flask-openapi3/\" target=\"_blank\"\u003e\n        \u003cimg class=\"off-glb\" src=\"https://img.shields.io/pypi/pyversions/flask-openapi3\" alt=\"pypi versions\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n**Flask OpenAPI3** is a web API framework based on **Flask**. It uses **Pydantic** to verify data and automatic\ngeneration of interaction documentation.\n\nThe key features are:\n\n- **Easy to code:** Easy to use and easy to learn\n\n- **Standard document specification:** Based on [OpenAPI Specification](https://spec.openapis.org/oas/v3.1.0)\n\n- **Interactive OpenAPI documentation:** [Swagger](https://github.com/swagger-api/swagger-ui), [Redoc](https://github.com/Redocly/redoc), [RapiDoc](https://github.com/rapi-doc/RapiDoc), [RapiPdf](https://mrin9.github.io/RapiPdf/), [Scalar](https://github.com/scalar/scalar), [Elements](https://github.com/stoplightio/elements)\n\n- **Data validation:** Fast data verification based on [Pydantic](https://github.com/pydantic/pydantic)\n\n## Requirements\n\nPython 3.9+\n\nflask-openapi3 is dependent on the following libraries:\n\n- [Flask](https://github.com/pallets/flask) for the web app.\n- [Pydantic](https://github.com/pydantic/pydantic) for the data validation.\n\n## Installation\n\n```bash\npip install -U flask-openapi3[swagger]\n```\n\nor\n\n```bash\nconda install -c conda-forge flask-openapi3[swagger]\n```\n\n\u003cdetails markdown=\"block\"\u003e\n\u003csummary\u003eOptional dependencies\u003c/summary\u003e\n\n- [python-email-validator](https://github.com/JoshData/python-email-validator) supports email verification.\n- [python-dotenv](https://github.com/theskumar/python-dotenv#readme) enables support\n  for [Environment Variables From dotenv](https://flask.palletsprojects.com/en/latest/cli/#dotenv) when running `flask`\n  commands.\n- [pyyaml](https://github.com/yaml/pyyaml) is used to output the OpenAPI document in yaml format.\n- [asgiref](https://github.com/django/asgiref) allows views to be defined with `async def` and use `await`.\n- [flask-openapi3-plugins](https://github.com/luolingchun/flask-openapi3-plugins) Provide OpenAPI UI for flask-openapi3.\n\nTo install these dependencies with flask-openapi3:\n\n```bash\npip install flask-openapi3[yaml]\n# or\npip install flask-openapi3[async]\n# or\npip install flask-openapi3[dotenv]\n# or\npip install flask-openapi3[email]\n# or all\npip install flask-openapi3[yaml,async,dotenv,email]\n# or manually\npip install pyyaml asgiref python-dotenv email-validator\n# OpenAPI UI plugins\npip install -U flask-openapi3[swagger,redoc,rapidoc,rapipdf,scalar,elements]\n```\n\n\u003c/details\u003e\n\n## A Simple Example\n\nHere's a simple example, further go to the [Example](https://luolingchun.github.io/flask-openapi3/latest/Example/).\n\n```python\nfrom pydantic import BaseModel\n\nfrom flask_openapi3 import Info, Tag\nfrom flask_openapi3 import OpenAPI\n\ninfo = Info(title=\"book API\", version=\"1.0.0\")\napp = OpenAPI(__name__, info=info)\n\nbook_tag = Tag(name=\"book\", description=\"Some Book\")\n\n\nclass BookQuery(BaseModel):\n    age: int\n    author: str\n\n\n@app.get(\"/book\", summary=\"get books\", tags=[book_tag])\ndef get_book(query: BookQuery):\n    \"\"\"\n    to get all books\n    \"\"\"\n    return {\n        \"code\": 0,\n        \"message\": \"ok\",\n        \"data\": [\n            {\"bid\": 1, \"age\": query.age, \"author\": query.author},\n            {\"bid\": 2, \"age\": query.age, \"author\": query.author}\n        ]\n    }\n\n\nif __name__ == \"__main__\":\n    app.run(debug=True)\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eClass-based API View Example\u003c/summary\u003e\n\n```python\nfrom typing import Optional\n\nfrom pydantic import BaseModel, Field\n\nfrom flask_openapi3 import OpenAPI, Tag, Info, APIView\n\n\ninfo = Info(title='book API', version='1.0.0')\napp = OpenAPI(__name__, info=info)\n\napi_view = APIView(url_prefix=\"/api/v1\", view_tags=[Tag(name=\"book\")])\n\n\nclass BookPath(BaseModel):\n    id: int = Field(..., description=\"book ID\")\n\n\nclass BookQuery(BaseModel):\n    age: Optional[int] = Field(None, description='Age')\n\n\nclass BookBody(BaseModel):\n    age: Optional[int] = Field(..., ge=2, le=4, description='Age')\n    author: str = Field(None, min_length=2, max_length=4, description='Author')\n\n\n@api_view.route(\"/book\")\nclass BookListAPIView:\n    a = 1\n\n    @api_view.doc(summary=\"get book list\")\n    def get(self, query: BookQuery):\n        print(self.a)\n        return query.model_dump_json()\n\n    @api_view.doc(summary=\"create book\")\n    def post(self, body: BookBody):\n        \"\"\"description for a created book\"\"\"\n        return body.model_dump_json()\n\n\n@api_view.route(\"/book/\u003cid\u003e\")\nclass BookAPIView:\n    @api_view.doc(summary=\"get book\")\n    def get(self, path: BookPath):\n        print(path)\n        return \"get\"\n\n    @api_view.doc(summary=\"update book\")\n    def put(self, path: BookPath):\n        print(path)\n        return \"put\"\n\n    @api_view.doc(summary=\"delete book\", deprecated=True)\n    def delete(self, path: BookPath):\n        print(path)\n        return \"delete\"\n\n\napp.register_api_view(api_view)\n\nif __name__ == \"__main__\":\n    app.run(debug=True)\n```\n\n\u003c/details\u003e\n\n## API Document\n\nRun the [simple example](https://github.com/luolingchun/flask-openapi3/blob/master/examples/simple_demo.py), and go to http://127.0.0.1:5000/openapi.\n\n\u003e OpenAPI UI plugins are optional dependencies that require manual installation.\n\u003e\n\u003e `pip install -U flask-openapi3[swagger,redoc,rapidoc,rapipdf,scalar,elements]`\n\u003e\n\u003e More optional ui templates goto the document\n\u003e about [UI_Templates](https://luolingchun.github.io/flask-openapi3/latest/Usage/UI_Templates/).\n\n![openapi](https://raw.githubusercontent.com/luolingchun/flask-openapi3/master/docs/images/openapi-all.png)\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluolingchun%2Fflask-openapi3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluolingchun%2Fflask-openapi3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluolingchun%2Fflask-openapi3/lists"}