Пример #1
0
class User(Linkable):
    userName = fields.Str(description="A unique user name.")
    friendlyName = fields.Str(
        required=True,
        description="The user's name in a form suitable to be rendered in a UI.",
    )
    email = fields.Str(description="(optional) the user's email address, if known.")
    roles = fields.List(
        fields.Str(),
        description="List of unique role names that apply to this user (can be empty).",
    )
Пример #2
0
class Version(LinkSchema):
    specVersion = fields.Str(
        description=
        ('The "major.minor" parts of the version of the spec supported by this '
         'implementation, e.g. "1.0"'),
        required=False,
    )
    implVersion = fields.Str(
        description=
        ("(optional) Version of the implementation itself (format is specific to "
         "the implementation)"),
        required=False,
    )
    additionalCapabilities = fields.Nested(VersionCapabilities)
Пример #3
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")
Пример #4
0
class ApiError(BaseSchema):
    code = fields.Integer(
        description="The HTTP status code.",
        required=True,
        example=404,
    )
    message = fields.Str(
        description="Detailed information on what exactly went wrong.",
        required=True,
        example="The resource could not be found.",
    )
    title = fields.Str(
        description="A summary of the problem.",
        required=True,
        example="Not found",
    )
    _fields = fields.Dict(
        data_key="fields",  # mypy
        keys=fields.String(description="The field name"),
        values=fields.List(fields.String(description="The error messages")),
        description="Detailed error messages on all fields failing validation.",
        required=False,
    )
Пример #5
0
class LinkSchema(BaseSchema):
    """A Link representation according to A-24 (2.7)"""

    domainType = fields.Constant("link", required=True)
    rel = fields.String(
        description=(
            "Indicates the nature of the relationship of the related resource to the "
            "resource that generated this representation"
        ),
        required=True,
        example="self",
    )
    href = fields.Str(
        description=(
            "The (absolute) address of the related resource. Any characters that are "
            "invalid in URLs must be URL encoded."
        ),
        required=True,
        example="https://.../api_resource",
    )
    method = fields.String(
        description="The HTTP method to use to traverse the link (get, post, put or delete)",
        required=True,
        pattern="GET|PUT|POST|DELETE",
        example="GET",
    )
    type = fields.String(
        description="The content-type that the linked resource will return",
        required=True,
        example="application/json",
    )
    title = fields.String(
        description=(
            "string that the consuming application may use to render the link without "
            "having to traverse the link in advance"
        ),
        allow_none=True,
        example="The object itself",
    )
    body_params = fields.Dict(
        description=(
            "A map of values that shall be sent in the request body. If this is present,"
            "the request has to be sent with a content-type of 'application/json'."
        ),
        required=False,
    )
Пример #6
0
class VersionCapabilities(BaseSchema):
    blobsClobs = fields.Bool(
        required=False,
        description="attachment support",
    )
    deleteObjects = fields.Bool(
        required=False,
        description=
        ("deletion of persisted objects through the DELETE Object resource C14.3,"
         " see A3.5"),
    )
    domainModel = fields.Str(
        required=False,
        description=
        ('different domain metadata representations. A value of "selectable" means '
         "that the reserved x-domain-model query parameter is supported, see A3.1"
         ),
    )
    protoPersistentObjects = fields.Bool()
    validateOnly = fields.Bool(
        required=False,
        description="the reserved x-ro-validate-only query parameter, see A3.2",
    )
Пример #7
0
class X509PEM(BaseSchema):
    cert = fields.Str(
        required=True,
        description="PEM-encoded X.509 certificate.",
    )