Skip to content

Commit 1e9406a

Browse files
committed
doc: document configuration options as well as how to easily migrate from Flask-RESPlus
1 parent 4193577 commit 1e9406a

File tree

2 files changed

+83
-2
lines changed

2 files changed

+83
-2
lines changed

doc/index.rst

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,36 @@
44
contain the root `toctree` directive.
55
66
Welcome to Flask-RESTX's documentation!
7-
==========================================
7+
=======================================
88

99
Flask-RESTX is an extension for Flask that adds support for quickly building REST APIs.
1010
Flask-RESTX encourages best practices with minimal setup.
1111
If you are familiar with Flask, Flask-RESTX should be easy to pick up.
1212
It provides a coherent collection of decorators and tools to describe your API
1313
and expose its documentation properly (using Swagger).
1414

15+
Flask-RESTX is a community driven fork of `Flask-RESTPlus
16+
<https://github.com/noirbizarre/flask-restplus>`_
17+
18+
19+
Why did we fork?
20+
================
21+
22+
The community has decided to fork the project due to lack of response from the
23+
original author @noirbizarre. We have been discussing this eventuality for
24+
almost `a long time <https://github.com/noirbizarre/flask-restplus/issues/593>`_.
25+
26+
Things evolved a bit since that discussion and a few of us have been granted
27+
maintainers access to the github project, but only the original author has
28+
access rights on the PyPi project. As such, we been unable to make any actual
29+
releases. To prevent this project from dying out, we have forked it to continue
30+
development and to support our users.
31+
1532

1633
Compatibility
1734
=============
1835

19-
flask-restx requires Python 2.7+.
36+
flask-restx requires Python 2.7+ or 3.4+.
2037

2138

2239
Installation

doc/quickstart.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@ and that you have already installed both Flask and Flask-RESTX.
1010
If not, then follow the steps in the :ref:`installation` section.
1111

1212

13+
Migrate from Flask-RESTPlus
14+
---------------------------
15+
16+
.. warning:: The *migration* commands provided bellow are here for the illustration.
17+
You may need to adapt them to properly fit your needs.
18+
We also recommend you make a backup of your project prior running them.
19+
20+
At this point, Flask-RESTX remains 100% compatible with Flask-RESTPlus' API.
21+
All you need to do is update your requirements to use Flask-RESTX instead of
22+
Flask-RESTPlus. Then you need to update all your imports.
23+
This can be done using something like:
24+
25+
::
26+
find . -type f -name "*.py" | xargs sed -i "s/flask_restplus/flask_restx/g"
27+
28+
Finally, you will need to update your configuration options (described `here
29+
<quickstart.html#configuration>`_). Example:
30+
31+
::
32+
find . -type f -name "*.py" | xargs sed -i "s/RESTPLUS_/RESTX_/g"
33+
34+
1335
Initialization
1436
--------------
1537

@@ -306,6 +328,48 @@ parameter to some classes or function to force order preservation:
306328
- globally on :class:`Namespace`: ``ns = Namespace(ordered=True)``
307329
- locally on :func:`marshal`: ``return marshal(data, fields, ordered=True)``
308330

331+
Configuration
332+
-------------
333+
334+
The following configuration options exist for Flask-RESTX:
335+
336+
============================ =============== ==================================
337+
OPTION DEFAULT VALUE DESCRIPTION
338+
============================ =============== ==================================
339+
``BUNDLE_ERRORS`` ``False`` Bundle all the validation errors
340+
instead of returning only the
341+
first one encountered.
342+
See the `Error Handling
343+
<parsing.html#error-handling>`__
344+
section of the documentation for
345+
details.
346+
``RESTX_VALIDATE`` ``False`` Whether to enforce payload
347+
validation by default when using
348+
the ``@api.expect()`` decorator.
349+
See the `@api.expect()
350+
<swagger.html#the-api-expect-decorator>`__
351+
documentation for details.
352+
``RESTX_MASK_HEADER`` ``X-Fields`` Choose the name of the *Header*
353+
that will contain the masks to
354+
apply to your answer.
355+
See the `Fields masks <mask.html>`__
356+
documentation for details.
357+
``RESTX_MASK_SWAGGER`` ``True`` Whether to enable the mask
358+
documentation in your swagger or
359+
not.
360+
See the `mask usage
361+
<mask.html#usage>`__ documentation
362+
for details.
363+
``RESTX_INCLUDE_ALL_MODELS`` ``False`` This option allows you to include
364+
all defined models in the generated
365+
Swagger documentation, even if they
366+
are not explicitly used in either
367+
``expect`` nor ``marshal_with``
368+
decorators.
369+
``RESTX_JSON`` ``{}`` Dictionary of options to pass to
370+
the json *serializer* (by default
371+
``json.dumps``).
372+
============================ =============== ==================================
309373

310374
Full example
311375
------------

0 commit comments

Comments
 (0)