Exemple #1
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)
Exemple #2
0
class User(Linkable):
    userName = fields.Str(description="a unique user name")
    friendlyName = fields.Str(
        required=True,
        description=
        "(optional) 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).",
    )
Exemple #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")
Exemple #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",
    )
    errors = fields.List(
        fields.String(),
        allow_none=True,
        description="Optionally a list of errors used for debugging.",
        example=None,
    )
Exemple #5
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,
    )
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,
    )
Exemple #7
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 media 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",
    )
    arguments = fields.Dict(
        description=
        ("map that may be used as the basis for any data (arguments or properties) "
         "required to follow the link."),
        allow_none=True,
    )
Exemple #8
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",
    )