Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
st-clair-clarke opened this issue Dec 2, 2024 · 0 comments

Comments

@st-clair-clarke
Copy link

st-clair-clarke commented Dec 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant