Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Validation with items missing field name #253

Open
lsbardel opened this issue Dec 29, 2020 · 0 comments
Open

Validation with items missing field name #253

lsbardel opened this issue Dec 29, 2020 · 0 comments

Comments

@lsbardel
Copy link
Member

The following dataclass

@dataclass
class Permission:
    methods: List[str] = fields.data_field(
        description="Http methods affected by this permission",
        items=fields.str_field(
            description="Http method",
            validator=fields.Choice(ALL_HTTP_METHODS),
        ),
    )
    path: str = fields.str_field(description="api path", required=True)
    action: str = fields.str_field(
        validator=fields.Choice(("allow", "deny")), default="allow"
    )

raise the following validation error when methods has wrong values.

{'errors': [{'field': 'permissions', 'message': {'null': 'foo not valid'}}]}

the field is missing and null is inserted instead

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant