Skip to content

Suggestion: Refactor builtin fields to expose validators for re-use #760

@bjmc

Description

@bjmc

For my use case, I want to have a custom field-getter using fields.Function() but the value it gets will be a UUID. I'd like to be able to have the same validation as the builtin fields.UUID(). However, that doesn't seem to be available in the validate module.

My suggestion is to refactor all the builtin field types so that they call validators in validate. That way, the same validators would also be exposed for reuse in custom user-defined fields.

As I'm imagining this, it would be a fully backwards-compatible change and the only difference to the public interface would be documenting/exposing new validators.

If that sounds like a good idea to the maintainers, I'm happy to take a crack at this and open a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions