Skip to content

Make schema coercion to standard data types json-compatible. #316

@industrialsynthfreak

Description

@industrialsynthfreak

Hi.

I often use jsons for validation schemas. This helps to provide more info about the config and makes it more versatile. This usually works great with Cerberus. The problems begin when I try to use coercion to standard data types.

So it would be reasonable, as I think, to add bool or string value support for coercion to be automatically converted into a type provided in the "type" param.

Like:

{"type": "integer", "coerce": true} -> {"type": "integer", "coerce": int}

or

{"type": "integer", "coerce": "int"} -> {"type": "integer", "coerce": int}

My apologies if I missed something and it already can do this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions