fief-dev / fief

Users and authentication management SaaS
https://www.fief.dev
Other
538 stars 44 forks source link

Empty string not accepted as valid user field #63

Closed davidbrochart closed 2 years ago

davidbrochart commented 2 years ago

Describe the bug

It looks like a user field of type String cannot have an empty string: "ensure this value has at least 1 characters".

To Reproduce

Steps to reproduce the behavior:

  1. Create or update a user field of type String with nothing in the text box.
  2. See error: "ensure this value has at least 1 characters".

Expected behavior

Should empty string be accepted as a valid value for user field of type String?

Configuration

frankie567 commented 2 years ago

Wow, it even produces a 500 error; which is clearly not a good behavior! Thanks for the report @davidbrochart!

frankie567 commented 2 years ago

Related Sentry report: https://sentry.io/share/issue/df87a329fc564b97b873683de435f389/

There is a inconsistency between the form validation (which is OK with empty strings) and the Pydantic validation (which is not OK with empty strings), so a ValidationError is raised here.