8000 [DX][Validation] Text/StringValidation · Issue #11875 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[DX][Validation] Text/StringValidation #11875
@peterrehm

Description

@peterrehm

We do have the form types text and textarea and in Doctrine the field types text and string.

If you use a string/text you usually expect some data but not special characters like a line feed.
This is no problem if you use the form component since you cannot enter a line feed in the input field.
If you however develop an API then you might get such unwanted characters in e.g. the name or
the street.

Should we add a validation constraint Text? It could have some defaults to disallow some special characters and options to customize that behavior?

With this we can support the developer to have a more consistent database without the hassle of adding an Regex validator.

I think at least double spaces and line breaks should be invalidated. I was using for this /(\s\s)|(\n)/ so far.

What do you think - Does this make sense? What should be invalidated?

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

      0