
Security News
The Nightmare Before Deployment
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.
flask-classful-apispec
Advanced tools
A pluggable API specification generator generator for Flask classful <https://flask-classful.teracy.org/>_ based on apispec <https://apispec.readthedocs.io/en/latest/>_
marshmallow <https://marshmallow.readthedocs.io/>_::
$ pip install flask-classful-apispec
.. code-block:: python
import json
from flask import Flask
from flask_classful import FlaskView
from flask_classful_apispec import APISpec
from marshmallow import Schema, fields
app = Flask(__name__)
app.config["DOC_TITLE"] = "Swagger petstore"
app.config["DOC_VERSION"] = "0.1.1"
app.config["DOC_OPEN_API_VERSION"] = "3.0.2"
spec = APISpec(app)
pets = [
{'id': 0, 'name': 'Kitty', 'category': 'cat'},
{'id': 1, 'name': 'Coco', 'category': 'dog'}
]
class PetSchema(Schema):
id = fields.Integer()
name = fields.String()
category = fields.String()
class PetView(FlaskView):
def index(self):
"""A pet api endpoint.
---
description: Get a list of pets
responses:
200:
schema: PetSchema
"""
return PetSchema(many=True).dumps(pets)
PetView.register(app)
spec.paths(PetView)
print(json.dumps(spec.to_dict(), indent=2))
if __name__ == "__main__":
app.run()
.. code-block:: json
{
"paths": {
"/pet/": {
"get": {
"description": "Get a list of pets",
"responses": {
"200": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
}
},
"info": {
"title": "Swagger petstore",
"version": "0.1.1"
},
"openapi": "3.0.2",
"components": {
"schemas": {
"Pet": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"id": {
"type": "integer"
},
"category": {
"type": "string"
}
}
}
}
}
}
apispec <https://apispec.readthedocs.io/en/latest/>_Flask classful <https://flask-classful.teracy.org/>_marshmallow <https://marshmallow.readthedocs.io/>_MIT licensed. See the bundled LICENSE <https://github.com/dev-rijan/flask-classful-apispec/blob/master/LICENSE>_ file for more details.
FAQs
Auto docs generation from marshmallow schema for flask classfy
We found that flask-classful-apispec demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.

Research
/Security News
Impostor NuGet package Tracer.Fody.NLog typosquats Tracer.Fody and its author, using homoglyph tricks, and exfiltrates Stratis wallet JSON/passwords to a Russian IP address.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.