Start explicit metadata argument for marshmallow
A side effect of re-locking dependencies is having a newer marshmallow. This deprecates having `description=` as a keyword, and puts it in a separate metadata arg instead. This commit is the start of my search-and-replaceing to update to the new format.
This commit is contained in:
parent
78ef9c531b
commit
e22f36b308
14 changed files with 58 additions and 58 deletions
|
|
@ -23,7 +23,7 @@ A **field** describes the data type of a single parameter, as well as any other
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
fields.String(required=False, missing="Default value", example="Example value")
|
||||
fields.String(required=False, load_default="Default value", example="Example value")
|
||||
|
||||
A **schema** is a collection of keys and fields describing how an object should be serialized/deserialized. Schemas can be created in several ways, either by creating a ``Schema`` class, or by passing a dictionary of key-field pairs. Both methods will be discussed in the following examples.
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ For example, if you are creating an API route, in which you expect parameters ``
|
|||
class UserSchema(Schema):
|
||||
name = fields.String(required=True)
|
||||
age = fields.Integer(required=True)
|
||||
job = fields.String(required=False, missing="Unknown")
|
||||
job = fields.String(required=False, load_default="Unknown")
|
||||
|
||||
To inform your POST method to expect these arguments, use the ``args`` class attribute:
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ Alternatively, if your schema is only used in a single location, it may be simpl
|
|||
args = {
|
||||
"name": fields.String(required=True),
|
||||
"age": fields.Integer(required=True),
|
||||
"job": fields.String(required=False, missing="Unknown")
|
||||
"job": fields.String(required=False, load_default="Unknown")
|
||||
}
|
||||
|
||||
def post(self, args):
|
||||
|
|
@ -88,7 +88,7 @@ This JSON data is the parsed, converted into a Python dictionary, and passed as
|
|||
args = {
|
||||
"name": fields.String(required=True),
|
||||
"age": fields.Integer(required=True),
|
||||
"job": fields.String(required=False, missing="Unknown")
|
||||
"job": fields.String(required=False, load_default="Unknown")
|
||||
}
|
||||
|
||||
def post(self, args):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue