Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flask-swagger-generator

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flask-swagger-generator

A library for generating swagger open api specifications for the Flask web framework

  • 0.4
  • PyPI
  • Socket score

Maintainers
1

Flask Swagger Generator

Flask swagger generator is a library to create Swagger Open API definitions for Flask based applications. Swagger is an Interface Description Language for describing REST APIs expressed using JSON and YAML.

Installing

Install and update using pip:

pip install flask-swagger-generator

Documentation

COMING SOON

A Simple Example

from flask import Blueprint, jsonify
from flask import Flask

from flask_swagger_generator.generators import Generator
from flask_swagger_generator.specifiers import SwaggerVersion
from flask_swagger_generator.utils import SecurityType

swagger_destination_path = '/static/swagger.yaml'

# Create the bluepints
blueprint = Blueprint('objects', __name__)

# Create the flask app
app = Flask(__name__)

# Create swagger version 3.0 generator
generator = Generator.of(SwaggerVersion.VERSION_THREE)

# Add security, response and request body definitions
@generator.security(SecurityType.BEARER_AUTH)
@generator.response(status_code=200, schema={'id': 10, 'name': 'test_object'})
@generator.request_body({'id': 10, 'name': 'test_object'})
@blueprint.route('/objects/<int:object_id>', methods=['PUT'])
def update_object(object_id):
    return jsonify({'id': 1, 'name': 'test_object_name'}), 201

app.register_blueprint(blueprint)
generator.generate_swagger(app, destination_path=swagger_destination_path)

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc