Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Example using marshmallow APISpec as base template for Flasgger specs
and using the Swagger UI new style layout version 3
"""
# coding: utf-8
from flask import Flask, jsonify
from flasgger import APISpec, Schema, Swagger, fields
from apispec.ext.marshmallow import MarshmallowPlugin
from apispec_webframeworks.flask import FlaskPlugin
# Create an APISpec
spec = APISpec(
title='Flasger Petstore',
version='1.0.10',
openapi_version='2.0',
plugins=[
FlaskPlugin(),
MarshmallowPlugin(),
],
)
app = Flask(__name__)
# Optional marshmallow support
class CategorySchema(Schema):
id = fields.Int()
name = fields.Str(required=True)
from .account import account as account_blueprint
app.register_blueprint(account_blueprint, url_prefix='/account')
from .api.auth import auth as auth_blueprint
app.register_blueprint(auth_blueprint, url_prefix='/auth')
from .admin import admin as admin_blueprint
app.register_blueprint(admin_blueprint, url_prefix='/admin')
from app.api.docs import docs as docs_blueprint
app.register_blueprint(docs_blueprint)
from flasgger import APISpec, Schema, Swagger, fields
spec = APISpec(
title='Bhagavad Gita API',
version='1.0.0',
plugins=[
'apispec.ext.flask',
'apispec.ext.marshmallow',
],
)
app.config['SWAGGER'] = {'title': 'Bhagavad Gita API', 'uiversion': 3}
swagger = Swagger(
app,
template={
'swagger': '2.0',
'info': {
'title': 'Bhagavad Gita API',
"""
Example using marshmallow APISpec as base template for Flasgger specs
"""
# coding: utf-8
from flask import Flask, jsonify
from flasgger import APISpec, Schema, Swagger, fields
from apispec.ext.marshmallow import MarshmallowPlugin
from apispec_webframeworks.flask import FlaskPlugin
# Create an APISpec
spec = APISpec(
title='Flasger Petstore',
version='1.0.10',
openapi_version='2.0',
plugins=[
FlaskPlugin(),
MarshmallowPlugin(),
],
)
app = Flask(__name__)
# Optional marshmallow support
class CategorySchema(Schema):
id = fields.Int()
name = fields.Str(required=True)