How to use the serpyco.string_field function in serpyco

To help you get started, we’ve selected a few serpyco examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algoo / hapic / example / fake_api / schema_serpyco.py View on Github external
@dataclasses.dataclass
class UserPathSchema(object):
    """A docstring to prevent auto generated docstring"""
    id: int = number_field(minimum=1, cast_on_load=True)


@dataclasses.dataclass
class UserSchema(object):
    """A docstring to prevent auto generated docstring"""
    first_name: str
    last_name: str
    display_name: str
    company: str
    username: str = string_field(pattern='[\w-]+')
    email_address: str = string_field(format_=StringFormat.EMAIL)
    id: typing.Optional[int] = None  # Note: must be optional to be unused in POST user


@dataclasses.dataclass
class PaginationSchema(object):
    """A docstring to prevent auto generated docstring"""
    first_id: int
    last_id: int
    current_id: int


@dataclasses.dataclass
class ListsUserSchema(object):
    """A docstring to prevent auto generated docstring"""
    pagination: PaginationSchema
    item_nb: int = number_field(minimum=0)
github algoo / hapic / example / usermanagement / schema_serpyco.py View on Github external
1 and 999
    """

    id: int = number_field(minimum=1, cast_on_load=True)


@dataclasses.dataclass
class UserSchema(object):
    """Complete representation of a user"""

    first_name: str
    last_name: typing.Optional[str]
    display_name: str
    company: typing.Optional[str]
    id: int
    email_address: str = string_field(format_=StringFormat.EMAIL)


@dataclasses.dataclass
class UserDigestSchema(object):
    """User representation for listing"""

    id: int
    display_name: str = ""


@dataclasses.dataclass
class UserAvatarSchema(object):
    """Avatar (image file) of user"""

    avatar: typing.Any
github algoo / hapic / example / fake_api / schema_serpyco.py View on Github external
@dataclasses.dataclass
class UserPathSchema(object):
    """A docstring to prevent auto generated docstring"""
    id: int = number_field(minimum=1, cast_on_load=True)


@dataclasses.dataclass
class UserSchema(object):
    """A docstring to prevent auto generated docstring"""
    first_name: str
    last_name: str
    display_name: str
    company: str
    username: str = string_field(pattern='[\w-]+')
    email_address: str = string_field(format_=StringFormat.EMAIL)
    id: typing.Optional[int] = None  # Note: must be optional to be unused in POST user


@dataclasses.dataclass
class PaginationSchema(object):
    """A docstring to prevent auto generated docstring"""
    first_id: int
    last_id: int
    current_id: int


@dataclasses.dataclass
class ListsUserSchema(object):
    """A docstring to prevent auto generated docstring"""
    pagination: PaginationSchema

serpyco

Fast serialization of dataclasses using Cython

MIT
Latest version published 8 months ago

Package Health Score

53 / 100
Full package analysis