You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/quickstart/basics.rst
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Let's take a look at a very basic API using Flask-Rebar:
25
25
@registry.handles(
26
26
rule='/todos/<id>',
27
27
method='GET',
28
-
marshal_schema=TodoSchema()
28
+
response_body_schema=TodoSchema()# for versions <= 1.7.0, use marshal_schema
29
29
)
30
30
defget_todo(id):
31
31
...
@@ -47,7 +47,7 @@ We then create a handler registry that we will use to declare handlers for the s
47
47
48
48
``method`` is the HTTP method that the handler will accept. To register multiple methods for a single handler function, decorate the function multiple times.
49
49
50
-
``marshal_schema`` is a Marshmallow schema that will be used marshal the return value of the function. `marshmallow.Schema.dump <http://marshmallow.readthedocs.io/en/latest/api_reference.html#marshmallow.Schema.dump>`_ will be called on the return value. ``marshal_schema`` can also be a dictionary mapping status codes to Marshmallow schemas - see :ref:`Marshaling`.
50
+
``response_body_schema`` is a Marshmallow schema that will be used marshal the return value of the function. `marshmallow.Schema.dump <http://marshmallow.readthedocs.io/en/latest/api_reference.html#marshmallow.Schema.dump>`_ will be called on the return value. ``response_body_schema`` can also be a dictionary mapping status codes to Marshmallow schemas - see :ref:`Marshaling`. *NOTE: In Flask-Rebar 1.0-1.7.0, this was referred to as ``marshal_schema``. It is being renamed and both names will function until version 2.0*
51
51
52
52
The handler function should accept any arguments specified in ``rule``, just like a Flask view function.
53
53
@@ -155,7 +155,7 @@ This default can be overriden in any particular handler by setting ``headers_sch
155
155
Marshaling
156
156
==========
157
157
158
-
The ``marshal_schema`` argument of ``HandlerRegistry.handles`` can be one of three types: a ``marshmallow.Schema``, a dictionary mapping integers to ``marshmallow.Schema``, or ``None``.
158
+
The ``response_body_schema`` (previously ``marshal_schema``) argument of ``HandlerRegistry.handles`` can be one of three types: a ``marshmallow.Schema``, a dictionary mapping integers to ``marshmallow.Schema``, or ``None``.
159
159
160
160
In the case of a ``marshmallow.Schema``, that schema is used to ``dump`` the return value of the handler function.
161
161
@@ -166,7 +166,7 @@ In the case of a dictionary mapping integers to ``marshmallow.Schemas``, the int
166
166
@registry.handles(
167
167
rule='/todos',
168
168
method='POST',
169
-
marshal_schema={
169
+
response_body_schema={
170
170
201: TodoSchema()
171
171
}
172
172
)
@@ -176,15 +176,15 @@ In the case of a dictionary mapping integers to ``marshmallow.Schemas``, the int
176
176
177
177
The schema to use for marshaling will be retrieved based on the status code the handler function returns. This isn't the prettiest part of Flask-Rebar, but it's done this way to help with the automatic Swagger generation.
178
178
179
-
In the case of ``None`` (which is also the default), no marshaling takes place, and the return value is passed directly through to Flask. This means the if ``marshal_schema`` is ``None``, the return value must be a return value that Flask supports, e.g. a string or a ``Flask.Response`` object.
179
+
In the case of ``None`` (which is also the default), no marshaling takes place, and the return value is passed directly through to Flask. This means the if ``response_body_schema`` is ``None``, the return value must be a return value that Flask supports, e.g. a string or a ``Flask.Response`` object.
0 commit comments