コード例 #1
0
class Parameter(Linkable):
    id = fields.String(
        description=
        ("the Id of this action parameter (typically a concatenation of the parent "
         "action Id with the parameter name)"),
        required=True,
        example='folder-move',
    )
    number = fields.Int(
        description="the number of the parameter (starting from 0)",
        required=True,
        example=0)
    name = fields.String(description="the name of the parameter",
                         required=True,
                         example='destination')
    friendlyName = fields.String(
        description=
        "the action parameter name, formatted for rendering in a UI.",
        required=True,
        example='The destination folder id',
    )
    description = fields.String(
        description=
        "a description of the action parameter, e.g. to render as a tooltip.",
        required=False,
        example='The destination')
    optional = fields.Bool(
        description="indicates whether the action parameter is optional",
        required=False,
        example=False,
    )

    # for string only
    format = fields.String(
        description=
        ("for action parameters requiring a string or number value, indicates how to"
         " interpret that value A2.5."),
        required=False,
    )
    maxLength = fields.Int(
        description=
        ("for string action parameters, indicates the maximum allowable length. A "
         "value of 0 means unlimited."),
        required=False,
    )
    pattern = fields.String(
        description=
        ("for string action parameters, indicates a regular expression for the "
         "property to match."),
        required=False,
    )
コード例 #2
0
class UserSchema(BaseSchema):
    id = fields.Int(dump_only=True)
    name = fields.Str(description="The user's name")
    created = fields.DateTime(dump_only=True,
                              format="iso8601",
                              default=dt.datetime.utcnow,
                              doc_default="The current datetime")