Skip to content

Feature suggestion - support for conversion of formatted strings #475

Closed
@samfrances

Description

@samfrances

It would be useful if jsonschema could provide support for retrieving a processed copy of the validated document, with automatic conversion of formatted strings into python data types.

This would have to be a configuration option on the validator/formatter, since not all format strings have an obvious native python data type (e.g. datetimes have an obvious native type, but "ipv4" may not).

So for example, with an appropriately configured validator, you could do something like:

doc = {"created_at": "2020-02-01 00:00:00"}
validator.validated(doc)
# --> {"created_at": datetime.datetime(2020, 2, 1, 0, 0)}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions