Skip to content

Releases: apiflask/apiflask

Version 0.10.1

26 Nov 08:26
Compare
Choose a tag to compare

Bugfix release:

  • Fix missing headers for JSON error responses when catching Werkzeug exceptions (issue #173).

Version 0.10.0

19 Sep 04:23
Compare
Choose a tag to compare

Features:

  • Add parameter extra_data to abort and HTTPError, it accepts a dict that will be added
    to the error response (#125).
from apiflask import abort

@app.get('/')
def missing():
    abort(404, message='nothing', extra_data={'code': '123', 'status': 'not_found'})
  • Support passing operation_id in the doc decorator (docs).
@app.get('/')
@doc(operation_id='myCustomHello')
def hello():
    pass
  • Support setting response links via @output(links=...) (docs).
pet_links = {
    'getAddressByUserId': {
        'operationId': 'getUserAddress',
        'parameters': {
            'userId': '$request.path.id'
        }
    }
}

@app.post('/pets')
@output(PetOutSchem, links=pet_links)
def new_pet(data):
    pass
  • Support using add_url_rule method on view classes.

Undocumented breaking changes:

  • Only expose marshmallow fields, validators, and Schema in APIFlask.
  • Remove the status_code field from the default error response (#124).

Version 0.9.0

10 Aug 03:54
Compare
Choose a tag to compare

Breaking change:

  • Custom error processor now should accept an HTTPError object instead of individual error information:
@app.error_processor
def my_error_processor(error):
    return {
        'status_code': error.status_code,
        'message': error.message,
        'errors': error.detail
    }, error.status_code, error.headers

Features:

  • Support base response schema customization (docs). See a full example at here.
  • Support setting custom schema name resolver via the APIFlask.schema_name_resolver attribute (docs).
  • Support to config Redoc via the configuration variable REDOC_CONFIG:
app.config['REDOC_CONFIG'] = {'disableSearch': True, 'hideLoading': True}

There are also some improvements on error handling, see the full changelog for more details: https://apiflask.com/changelog/#version-090

Version 0.8.0

07 Jul 05:30
59bd8f6
Compare
Choose a tag to compare

This is the first stable version. From this version, all breaking changes will start with a deprecated warning.

Some major changes in this version:

  • Automatically add a 404 response in OpenAPI spec for routes contains URL
    variables:
@app.get('/pets/<id>')
def get_pet(id):
    pass

So user don't need to set a 404 response manually:

@app.get('/pets/<id>')
@doc(responses=[404])
def get_pet(id):
    pass
  • The app.spec property now will always return the latest spec instead of the cached one (docs):
>>> from apiflask import APIFlask
>>> app = APIFlask(__name__)
>>> app.spec
{'info': {'title': 'APIFlask', 'version': '0.1.0'}, 'tags': [], 'paths': OrderedDict(), 'openapi': '3.0.3'}
>>> @app.get('/')
... def hello():
...     return {'message': 'Hello'}
...
>>> app.spec
{'info': {'title': 'APIFlask', 'version': '0.1.0'}, 'tags': [], 'paths': OrderedDict([('/', {'get': {'parameters': [], 'responses': OrderedDict([('200', {'content': {'application/json': {'schema': {}}}, 'description': 'Successful response'})]), 'summary': 'Hello'}})]), 'openapi': '3.0.3'}
>>>
  • Add configration variable INFO (and app.info attribute), it can be used to set the following info fields: description, termsOfService, contact, license (docs):
app.info = {
    'description': '...',
    'termsOfService': 'http://example.com',
    'contact': {
        'name': 'API Support',
        'url': 'http://www.example.com/support',
        'email': '[email protected]'
    },
    'license': {
        'name': 'Apache 2.0',
        'url': 'http://www.apache.org/licenses/LICENSE-2.0.html'
    }
}
  • Rename the following configuration variables:
    • AUTO_PATH_SUMMARY -> AUTO_OPERATION_SUMMARY
    • AUTO_PATH_DESCRIPTION -> AUTO_OPERATION_DESCRIPTION

See details in the changelog: https://github.com/greyli/apiflask/blob/main/CHANGES.md#version-080

Version 0.7.0

24 Jun 13:08
Compare
Choose a tag to compare

Some major changes in this version:

  • Add a flask spec command to output the OpenAPI spec to stdout or a file (docs).
  • Support keeping the local spec in sync automatically (docs).
  • Re-add the SPEC_FORMAT config. Remove the auto-detection of the format from APIFlask(spec_path=...) (docs).
  • Fix auto-tag support for nesting blueprint.
  • Add a new docs chapter for OpenAPI generating: https://apiflask.com/openapi/

See more in the changelog: https://github.com/greyli/apiflask/blob/main/CHANGES.md#version-070

Version 0.6.3

17 May 03:27
Compare
Choose a tag to compare

Improve static request dispatch (#54).

Version 0.6.2

16 May 14:49
c4f5130
Compare
Choose a tag to compare

Fix static request dispatch issue for Flask 2.0 (#52).

Version 0.6.1

15 May 13:23
Compare
Choose a tag to compare

A bugfix release for Flask 2.0:

  • Fix various type annotation issues.
  • Fix async support.

See the changelog for the details:

https://github.com/greyli/apiflask/blob/master/CHANGES.md#version-061

Version 0.6.0

11 May 06:04
Compare
Choose a tag to compare

This release is mainly for Flask 2.0.

  • Support using async def that comes in Flask 2.0.
  • Add some helpers for pagination (example application).

Seet the changelog for more details.

Version 0.5.2

29 Apr 07:08
Compare
Choose a tag to compare

A bugfix release.

  • Allow returning a Response object in a view function decorated with output decorator. In this case, APIFlask will do nothing but return it directly.
  • Skip Flask's Blueprint objects when generating the OpenAPI spec