{"id":8998,"library":"flask-swagger","title":"Flask-Swagger","description":"Flask-Swagger is a Python library designed to extract Swagger 2.0 specifications from Flask projects. Its latest version is 0.2.14, released in February 2021. The project appears to be in maintenance mode with infrequent updates, and lacks support for newer Python versions (3.9+) and OpenAPI 3.0.","status":"deprecated","version":"0.2.14","language":"en","source_language":"en","source_url":"https://github.com/gangverk/flask-swagger","tags":["flask","swagger","openapi","documentation","api-specs","deprecated"],"install":[{"cmd":"pip install flask-swagger","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Web framework integration","package":"Flask"},{"reason":"YAML parsing for spec definitions","package":"PyYAML"},{"reason":"JSON Schema validation","package":"jsonschema"}],"imports":[{"symbol":"swagger","correct":"from flask_swagger import swagger"}],"quickstart":{"code":"from flask import Flask, jsonify\nfrom flask_swagger import swagger\n\napp = Flask(__name__)\n\n@app.route('/spec')\ndef spec():\n    swag = swagger(app)\n    swag['info']['title'] = \"My Flask API\"\n    swag['info']['version'] = \"1.0\"\n    return jsonify(swag)\n\n@app.route('/hello/<name>')\ndef hello(name):\n    \"\"\"\n    Hello World Endpoint\n    This is a test endpoint returning a greeting.\n    ---\n    parameters:\n      - name: name\n        in: path\n        type: string\n        required: true\n        default: World\n    responses:\n      200:\n        description: A greeting message\n        schema:\n          type: string\n          example: Hello, John!\n    \"\"\"\n    return f\"Hello, {name}!\"\n\n# To run the app:\n# if __name__ == '__main__':\n#     app.run(debug=True)","lang":"python","description":"This quickstart demonstrates how to integrate Flask-Swagger into a Flask application to generate Swagger 2.0 API specifications. It sets up a `/spec` endpoint to serve the JSON specification and a simple `/hello/<name>` endpoint with docstring-based Swagger annotations."},"warnings":[{"fix":"Migrate to `flasgger` (pip install flasgger) or `flask-restx` (pip install flask-restx).","message":"Flask-Swagger is no longer actively maintained and has known compatibility issues with Python versions 3.9 and newer. For modern OpenAPI (3.x) support and active development, consider using `flasgger` or `flask-restx`.","severity":"deprecated","affected_versions":"<=0.2.14"},{"fix":"Use a library like `flasgger` or `flask-restx` which supports OpenAPI 3.x.","message":"This library exclusively supports Swagger 2.0 specifications. It does not provide support for the newer OpenAPI 3.x standards. If your project requires OpenAPI 3.x, an alternative library is necessary.","severity":"gotcha","affected_versions":"<=0.2.14"},{"fix":"Update your Swagger specification definitions to use `id` where appropriate, following the Swagger 2.0 specification.","message":"In version 0.2.0, a change was introduced where Swagger specifications should reference 'id' instead of 'name' in certain contexts (e.g., for operation IDs). Code written for pre-0.2.0 versions may break.","severity":"breaking","affected_versions":"<0.2.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install flask-swagger` to install the package.","cause":"The flask-swagger package is not installed or not available in the current Python environment.","error":"ModuleNotFoundError: No module named 'flask_swagger'"},{"fix":"Import `jsonify` from `flask` and wrap the `swagger` output: `return jsonify(swagger(app))`.","cause":"The Flask `swagger` function returns a dictionary, which must be converted to a JSON response using Flask's `jsonify` utility before returning from a view function.","error":"TypeError: object of type 'Response' is not JSON serializable"},{"fix":"Ensure `swagger(app)` is called within the context of a running Flask application, typically inside a view function or after `app` has been fully configured.","cause":"The `swagger(app)` function might be called outside of an application context or before the Flask app instance is properly initialized, especially if trying to access application config or routes dynamically.","error":"RuntimeError: No application found. Either work inside a request context or set the 'FLASK_APP' environment variable."}]}