All Projects → factset → quart-openapi

factset / quart-openapi

Licence: other
Module for Quart to add Flask-RESTPlus like functionality

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to quart-openapi

AlipayOpenapiCpp
支付宝开放平台的C\C++版接入示例代码,包含加签验签\网络请求\参数组装\报文解析等等;仅供商户或开发者参考使用;
Stars: ✭ 44 (-37.14%)
Mutual labels:  openapi
HibiAPI
一个实现了多种常用站点的易用化API的程序 / A program that implements easy-to-use APIs for a variety of commonly used sites.
Stars: ✭ 427 (+510%)
Mutual labels:  openapi
microblog-api
A modern (as of 2022) Flask API back end.
Stars: ✭ 218 (+211.43%)
Mutual labels:  openapi
laravel-openapi
Generate OpenAPI specification for Laravel Applications
Stars: ✭ 269 (+284.29%)
Mutual labels:  openapi
advanced-spring-scaffold
This project provides an advanced baseline to help you kick start a Spring project.
Stars: ✭ 21 (-70%)
Mutual labels:  openapi
OpenAlchemy
Define SQLAlchemy models using the OpenAPI specification.
Stars: ✭ 39 (-44.29%)
Mutual labels:  openapi
minter-go-sdk
Minter Blockchain Golang SDK, 💳 wallet, 🧾 transactions, gRPC and HTTP clients 🌐 https://t.me/MinterGoSDK
Stars: ✭ 12 (-82.86%)
Mutual labels:  openapi
rapiclient
Dynamic Open API (Swagger) Client for R
Stars: ✭ 55 (-21.43%)
Mutual labels:  openapi
dataclasses-jsonschema
JSON schema generation from dataclasses
Stars: ✭ 145 (+107.14%)
Mutual labels:  openapi
n26-api
Unofficial N26 Bank API documentation
Stars: ✭ 41 (-41.43%)
Mutual labels:  openapi
swakka
A Scala library for creating Swagger definitions in a type-safe fashion wth Akka-Http
Stars: ✭ 74 (+5.71%)
Mutual labels:  openapi
serverless-openapi-documentation
Serverless 1.0 plugin to generate OpenAPI V3 documentation from serverless configuration
Stars: ✭ 83 (+18.57%)
Mutual labels:  openapi
yamlinc
Compose multiple YAML files into one with $include tag. Split Swagger/OpenAPI into multiple YAML files.
Stars: ✭ 103 (+47.14%)
Mutual labels:  openapi
Ktor-OpenAPI-Generator
Ktor OpenAPI/Swagger 3 Generator
Stars: ✭ 203 (+190%)
Mutual labels:  openapi
cli
Panacloud Command Line Interface (CLI) uses the design-first approach for developing APIs. It generates Modern Multi-Tenant Serverless Cloud API infrastructure, mocks, stubs, tests, and stages using CDK. GraphQL schemas and OpenAPI specifications are used to implement the design-first approach.
Stars: ✭ 23 (-67.14%)
Mutual labels:  openapi
oas
OpenAPI Spec builder in go
Stars: ✭ 15 (-78.57%)
Mutual labels:  openapi
apispec-webframeworks
Web framework plugins for apispec (formally in apispec.ext).
Stars: ✭ 25 (-64.29%)
Mutual labels:  openapi
optimade-python-tools
Tools for implementing and consuming OPTIMADE APIs in Python
Stars: ✭ 38 (-45.71%)
Mutual labels:  openapi
datadog-api-client-python
Python client for the Datadog API
Stars: ✭ 44 (-37.14%)
Mutual labels:  openapi
mapi-action
🤖 Run a Mayhem for API scan in GitHub Actions
Stars: ✭ 16 (-77.14%)
Mutual labels:  openapi

Quart-OpenAPI

https://travis-ci.com/factset/quart-openapi.svg?branch=master

Documentation can be found on https://factset.github.io/quart-openapi/

Quart-OpenAPI is an extension for Quart that adds support for generating a openapi.json file using openapi 3.0. If you are familiar with Quart, this just wraps around it to add a openapi.json route similar to Flask-RESTX generating a swagger.json route and adds a Resource base class for building RESTful APIs.

Compatibility

Quart-OpenAPI requires Python 3.6+ because Quart requires it.

Starting from version 1.6.0, Quart-OpenAPI requires python 3.7+ in order to avoid having to maintain multiple versions of function definitions for compatibility with the older versions of Quart that supported Python 3.6.

Installation

You can install via pip

$ pip install quart-openapi

If you are developing the module and want to also be able to build the documentation, make sure to also install the dependencies from the extras 'doc' package like so:

$ pip install 'quart-openapi[doc]'
$ python setup.py build_sphinx

Quick Start

If you're familiar with Quart then the quick start doesn't change much:

from quart_openapi import Pint, Resource

app = Pint(__name__, title='Sample App')

@app.route('/')
class Root(Resource):
  async def get(self):
    '''Hello World Route

    This docstring will show up as the description and short-description
    for the openapi docs for this route.
    '''
    return "hello"

This is equivalent to using the following with Quart as normal:

from quart import Quart
app = Quart(__name__)

@app.route('/')
async def hello():
  return "hello"

Except that by using :class:`~quart_openapi.Pint` and :class:`~quart_openapi.Resource` it will also add a route for '/openapi.json' which will contain the documentation of the route and use the docstring for the description.

Unit Tests

Unit tests can be run through setuptools also:

$ python setup.py test

Request Validation

Request validation like you can get with Flask-RESTX!

You can either create validator models on the fly or you can create a jsonschema document for base models and then use references to it. For an on-the-fly validator:

expected = app.create_validator('sample_request', {
  'type': 'object',
  'properties': {
    'foobar': {
      'type': 'string'
    },
    'baz': {
      'oneOf': [
        { 'type': 'integer' },
        { 'type': 'number', 'format': 'float' }
      ]
    }
  }
})

@app.route('/')
class Sample(Resource):
  @app.expect(expected)
  async def post(self):
    # won't get here if the request didn't match the expected schema
    data = await request.get_json()
    return jsonify(data)

The default content type is 'application/json', but you can specify otherwise in the decorator:

In the example above, it'll open, read, and json parse the file schema.json and then use it as the basis for referencing models and creating validators. Currently the validator won't do more than validate content-type for content-types other than 'application/json'.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].