Features:
- Official Python 3.8 support (:pr:`108`).
Bug fixes:
- Fix passing
spec_kwargs
inApi.__init__
andapp
inApi.init_app
(:issue:`103`).
Rename to flask-smorest (:issue:`42`).
Features:
- Backwards-incompatible: Only return status code and short name in error handler (:pr:`84`).
- Backwards-incompatible: Remove logging from error handler. Logging can be
achieved in application code by overriding
handle_http_exception
. Remove_prepare_error_response_content
. Reponse payload is computed inhandle_http_exception
. (:pr:`85`) - Backwards-incompatible: Remove
InvalidLocationError
. The mapping from webargs locations to OAS locations is done in apispec and no exception is raised if an invalid location is passed. (:pr:`81`) - Add
content_type
argument toBlueprint.arguments
and provide reasonable default content type forform
andfiles
(:pr:`83`). - Add
description
parameter toBlueprint.arguments
to pass description forrequestBody
(:pr:`93`). - Allow customization of docstring delimiter string (:issue:`49`).
- Support file uploads as multipart/form-data (:pr:`97`).
Bug fixes:
- Fix documentation of
form
andfiles
arguments: userequestBody
in OAS3, document content type (:pr:`83`).
Other changes:
- Backwards-incompatible: Don't republish
NestedQueryArgsParser
anymore. This belongs to user code and can be copied from webargs doc (:pr:`94`). - Backwards-incompatible: Bump minimum apispec version to 3.0.0.
Bug fixes:
- Fix detection of unhandled exceptions in error handler for Flask=>1.1.0 (:pr:`82`).
Other changes:
- Bump minimum Flask version to 1.1.0. From this version on, uncaught
exceptions are passed to the error handler as
InternalServerError
with the exception attached asoriginal_exception
attribute. (:pr:`82`)
Features:
- Add
parameters
argument toBlueprint.route
to pass documentation for parameters that are shared by all operations of a path (:pr:`78`).
Other changes:
- Backwards-incompatible: Bump minimum apispec version to 2.0.0.
- Backwards-incompatible: Path parameters documentation passed in
Blueprint.doc
is no longer merged with automatic documentation. It should be passed inBlueprint.route
instead. - Backwards-incompatible: Remove
Api.schema
andApi.definition
. Those methods are useless sinceSchema
components are automatically registered by apispec. Manual component registration is still possible using the internal apispecComponents
object. (:pr:`75`)
Bug fixes:
- marshmallow 3.0.0rc7 compatibility (:pr:`77`).
Features:
- Add parameters to pass examples and headers in
Blueprint.response
decorator (:pr:`63`). - Add parameters to pass examples for
requestBody
in OpenAPI v3 inBlueprint.arguments
decorator (:pr:`68`). - Support status codes expressed as
HTTPStatus
inBlueprint.response
decorator (:issue:`60`). Thanks :user:`Regzand` for reporting.
Other changes:
- Bump minimum apispec version to 1.3.2.
- Bump minimum werkzeug version to 0.15. With 0.14.x versions, 412 responses are returned with no content.
- Backwards-incompatible: When using
Blueprint.doc
decorator to provide additional documentation to the response described in theBlueprint.response
decorator, the user must use the same format (str
,int
orHTTPStatus
) to express the status code in both decorators. This is a side-effect of (:issue:`60`). Now that headers and examples can be described inBlueprint.response
, this should not be a common use case.
Features:
- Official Python 3.7 support (:pr:`45`).
- Rename
Api.definition
asApi.schema
. KeepApi.definition
as an alias toApi.schema
for backward compatibility (:pr:`53`).
Bug fixes:
- Fix passing route with path parameter default value (:pr:`58`). Thanks :user:`zedrdave` for reporting.
- When no descrition is provided to
Blueprint.response
, don't add an empty string as description in the docs. - Fix returning a
tuple
subclass from a view function. Only rawtuple
instances are considered as Flask's (return value, status, headers).tuple
subclasses are treated aslist
and can be paginated/dumped. Rawtuple
return values should be cast to another type (e.g.list
) to be distinguished from (return value, status, headers) tuple. (:issue:`52`) Thanks :user:`asyncee` for reporting.
Features:
- Allow view functions decorated with
response
to return aResponse
object or a tuple with status and/or headers (:pr:`40`). - Allow view functions decorated with
paginate
to return a tuple with status and/or headers (:pr:`40`). The pagination header is now passed in the response tuple. Users relying on undocumentedget_context()['headers']
as a workaround to pass headers must update their code to pass headers in the response tuple as well.
Bug fixes:
- Fix ETag computation when headers contain a duplicate key.
Features:
- Register Werkzeug's
UUIDConverter
inApi
so thatuuid
path parameters are correctly documented.
Features:
- Add
flask_plugin
andmarshmallow_plugin
spec kwargs to allow overriding base plugins. - Backwards-incompatible: Rename
plugins
spec kwarg intoextra_plugins
. - Backwards-incompatible: Don't default to OpenAPI version 2.0. The version
must now be specified, either as
OPENAPI_VERSION
app parameter or asopenapi_version
spec kwarg. - Support apispec 1.0.0.
- Backwards-incompatible: Drop support for apispec 0.x.
Features:
- Backwards-incompatible:
Api.register_converter
doesn't register converter in Flask app anymore. It should be registered manually usingapp.url_map.converters['converter_name'] = Converter
. Api.definition
,Api.register_field
andApi.register_converter
can be called before app initialization. The information is buffered and passed to the internalAPISpec
object when it is created, inApi.init_app
.
Bug fixes:
- Fix typo in
ErrorHandlerMixin._prepare_error_response_content
.
Features:
- The
HTTP_METHODS
list that defines the order of the methods in the spec is now a class attribute ofBlueprint
. It can be overridden to enforce another order.
Bug fixes:
- Import
Mapping
fromcollections.abc
rather thancollections
. The latter is deprecated in Python 3.7 and will be removed in 3.8. - Merge manual doc added with
Blueprint.doc
with automatic documentation after auto doc is prepared (i.e. adapted to OpenAPI version) (:issue:`19`). Thanks :user:`fbergroth` for reporting. - Merge automatic path parameter documentation with existing manual doc rather than append as duplicate parameter (:issue:`23`). Thanks :user:`congenica-andrew` for reporting.
- Fix path parameter documentation structure when using OpenAPI v3.
- Document http status codes as strings, not integers.
- Fix use of Swagger UI config parameter
OPENAPI_SWAGGER_UI_URL
.
Other changes:
- 100% test coverage !
Features:
- Backwards-incompatible: Rework of the ETag feature. It is now accesible
using dedicated
Blueprint.etag
decorator.check_etag
andset_etag
are methods ofBlueprint
andetag.INCLUDE_HEADERS
is replaced withBlueprint.ETAG_INCLUDE_HEADERS
. It is enabled by default (only on views decorated withBlueprint.etag
) and disabled withETAG_DISABLED
application configuration parameter.is_etag_enabled
is now private. (:pr:`21`) - Backwards-incompatible: The
response
decorator returns aResponse
object rather than a (Response
object, status code) tuple. The status code is set in theResponse
object. - Support apispec 1.0.0b5.
Features:
- Backwards-incompatible: Don't prefix all routes in the spec with
APPLICATION_ROOT
. If using OpenAPI v2, setAPPLICATION_ROOT
asbasePath
. If using OpenAPI v3, the user should specifyservers
manually. - Backwards-incompatible: In testing and debug modes,
verify_check_etag
not only logs a warning but also raisesCheckEtagNotCalledError
ifcheck_etag
is not called in a resource that needs it.
Features:
Api.register_blueprint
passes**options
keyword parameters toapp.register_blueprint
to overrideBlueprint
defaults. Thanks :user:`dryobates` for the suggestion.
Features:
- Support apispec 1.0.0b3.
Bug fixes:
- Fix crash when serving documentation at root of application. Thanks :user:`fbergroth` for the suggestion.
Features:
- Backwards-incompatible: When pagination parameters are out of range, the API does not return a 404 error anymore. It returns a 200 code with an empty list and pagination metadata (:pr:`10`).
- Backwards-incompatible: Remove dependency on python-dateutil. This is an optional marshmallow dependency. Whether it is needed to deserialize date, time, or datetime strings depends on the application.
- Rework internal features by using mixin classes. This makes the code cleaner and adds customization possibilities (:issue:`9`).
- Backwards-incompatible:
DEFAULT_PAGINATION_PARAMETERS
is a class attribute ofBlueprint
. - Backwards-incompatible: When no
Page
class is passed topagination
, (i.e. when doing pagination in view function), the pagination parameters are passed as aPaginationParameters
object. The item count must be passed by setting it asitem_count
attribute of thePaginationParameters
object. Theset_item_count
function is removed. - The pagination header name can be configured by overriding
PAGINATION_HEADER_FIELD_NAME
class attribute ofBlueprint
. If set toNone
, no pagination header is added to the response. - Backwards-incompatible: The
paginate
decorator doesn't useNestedQueryFlaskParser
by default. It is renamed asNestedQueryArgsParser
and it can be used by overridingBlueprint.ARGUMENTS_PARSER
. - Backwards-incompatible: Drop Flask 0.x support. Flask>=1.0 is now required.
- Default error handler is registered for generic
HTTPException
. Other extensions may register other handlers for specific exceptions or codes (:pr:`12`).
Features:
- Add page (page number) to pagination metadata.
- Set produces and consumes root document attributes when using OpenAPI v2.
Bug fixes:
- Document body parameter correctly when using OpenAPI v3.
Features:
- Add
API_SPEC_OPTIONS
app config parameter. Thanks :user:`xalioth` for the suggestion. - Backwards-incompatible:
Api
accepts aspec_kargs
parameter, passed as kwargs to the internalAPISpec
instance.spec_plugins
is removed, plugins shall be passed asspec_kwargs={'plugins': [...]}
. - Backwards-incompatible: Get summary and description from docstrings (:pr:`5`).
- Add support for marshmallow 3.0.0b13. 2.x and 3b are now supported.
- Add support for apispec 1.0.0b2. 0.x and 1b are now supported.
Bug fixes:
- Document response schema correctly when using OpenAPI 3 (:issue:`8`). Thanks :user:`ffarella` for reporting.
Other changes:
- Backwards-incompatible: Remove
_wrapper_class
fromPage
. Creating a custom pager is easier by just overridingPage
methods. - Backwards-incompatible: Let
OPENAPI_SWAGGER_UI_SUPPORTED_SUBMIT_METHODS
default to "all methods" list.
Bug fixes:
- Swagger UI integration: respect
OPENAPI_SWAGGER_UI_URL
configuration paramater. Api.register_field
: useAPISpec.register_field
rather than accessself.spec.ma_plugin
directly.
Features:
- Backwards-incompatible: Use apispec 0.39.0 plugin class interface.
- Backwards-incompatible: Expose APISpec's
register_field
andregister_converter methods
fromApi
object.Api.register_converter
signature is modified to makename
parameter optional. - Pass extra apispec plugins to internal APISpec instance.
- Backwards-incompatible: Drop official support for Python 3.4.
Features:
- Pass OpenAPI version as
OPENAPI_VERSION
app config parameter. - Add Swagger UI (3.x) integration.
Features:
- ReDoc: Use unpkg CDN for 2.x version.
Features:
- Backwards-incompatible: In
Blueprint.route
, the endpoint name defaults to the function name with the case unchanged. Before this change, the name was lowercased. - Backwards-incompatible: Pagination is now managed by dedicated
Blueprint.paginate
decorator. - Add
etag.INCLUDE_HEADERS
to specify which headers to use for ETag computation (defaults to['X-Pagination']
). - In
verify_check_etag
, endpoint name is added to the warning message.
Bug fixes:
- Pagination: don't crash if
item_count
is not set, just log a warning and set no pagination header. - API spec: Fix leading/trailing slash issues in api-docs Blueprint. Fixes compatibility with Flask 1.0.
Features:
- Allow multiple calls to
Blueprint.arguments
on a view function. - Enforce order of fields in
PaginationParametersSchema
andPaginationMetadataSchema
. - Minor improvements in test_examples.py.
Features:
- Backwards-incompatible: The case of a parameter both in URL and in arguments Schema is now unsupported.
- Backwards-incompatible: By default, Schema parameter passed in
Blueprint.arguments
is documented as required. - Backwards-incompatible:
APISpec.register_field
now uses apispec API. It must be passed a(type, format)
couple or an already registeredField
class (this includes base marshmallowFields
. When using(type, format)
,format
doesn't default toNone
anymore. - Preserve order when serving the spec file: - Fields are printed in declaration order if Schema.Meta.ordered is True - Methods in a method view are printed in this order: ['OPTIONS', 'HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE'] - Paths are added in declaration order
Bug fixes:
- Document response as array when using paginate_with.
Features:
- Add leading and trailing
/
to OPENAPI_URL_PREFIX if missing. - Backwards-incompatible: Change default URL path for OpenAPI JSON to
'openapi.json'
.
Bug fixes:
- Fix OpenAPI docs URL paths.
- Backwards-incompatible:
Blueprint.route(self, rule, **options)
matchesflask
'sBlueprint
signature.
Features:
format
parameter inregister_converter
andregister_field
is now optional and defaults toNone
.- APISpec inherits from original apispec.APISpec.
- Backwards-incompatible: The internal
APISpec
instance is now exposed as public attributespec
ofApi
.register_converter
andregister_field
are not proxied anymore byApi
and must be called onspec
. - Backwards-incompatible:
Api.register_converter
takes aname
parameter and registers a converter in theFlask
application as well as in its internalAPISpec
instance. - Backwards-incompatible:
Api.register_spec_plugin
is removed.api.register_spec_plugin(...)
shall be replaced withapi.spec.setup_plugin(...)
.
Bug fixes:
- Fix version number.
Support:
- Add dev-requirements.txt.
First release.