@@ -10,6 +10,28 @@ and that you have already installed both Flask and Flask-RESTX.
10
10
If not, then follow the steps in the :ref: `installation ` section.
11
11
12
12
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
+
13
35
Initialization
14
36
--------------
15
37
@@ -306,6 +328,48 @@ parameter to some classes or function to force order preservation:
306
328
- globally on :class: `Namespace `: ``ns = Namespace(ordered=True) ``
307
329
- locally on :func: `marshal `: ``return marshal(data, fields, ordered=True) ``
308
330
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
+ ============================ =============== ==================================
309
373
310
374
Full example
311
375
------------
0 commit comments