transmute-coreΒΆ
transmute-core takes python functions, and converts them into APIs that include schema validation and documentation via swagger.
more specifically, transmute provides:
- declarative generation of http handler interfaces by parsing python functions.
- validation and serialization to and from a variety of content types (e.g. json or yaml).
- validation and serialization to and from native python objects which use schematics.
- autodocumentation of all handlers generated this way, via swagger.
transmute-core is the core library, containing shared functionality across framework-specific implementations.
Implementations exist for:
An example in flask looks like:
import flask_transmute
from flask import Flask
app = Flask(__name__)
# api GET method, path = /multiply
# take query arguments left and right which are integers, return an
# integer.
@flask_transmute.route(app, paths='/multiply')
@flask_transmute.annotate({"left": int, "right": int, "return": int})
def multiply(left, right):
return left * right
# finally, you can add a swagger json and a swagger-ui page by:
flask_transmute.add_swagger(app, "/swagger.json", "/swagger")
app.run()
more specifically, transmute-core provides:
transmute-core is released under the MIT license.
However, transmute-core bundles swagger-ui with it, which is released under the Apache2 license.
To use this functionality, it’s recommended to build or use a framework-specific wrapper library, to handle a more fluid integration.
If you are interested in creating a transmute library for your preferred web framework, please read Creating a framework-specific library. If you are interested in having it appear on this page, please send a PR against the core project.
User’s Guide:
API Reference:
Changelog: