Skip to content

How to get the error message to contain 'nonempty' refinement when a 'pattern' is used #1288

@st-clair-clarke

Description

@st-clair-clarke

I have the following:

NameStruct {
   first: nonempty(size( pattern( string(), nounRegex()as RegExp), 2, 20)),
}

When the first property is empty (''), it is the pattern error that is generated

{key: 'first', message: 'At path: first -- Expected a string matching `/^[A-Za-z\' -]+$/` but received ""', refinement: 'pattern', value: ''}
key
: 
"first"
message
: 
"At path: first -- Expected a string matching `/^[A-Za-z' -]+$/` but received \"\""
refinement
: 
"pattern"
value
: 
""

How can I get the error message to show the 'nonempty' refinement

NB. I am actually attempting to make a text input required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions