breezebreeze-sharp

"required fields" don't allow empty string


If a model has what Breeze considers to be a "required field" string property (so far I have encountered key properties and TPH discriminator properties) then Breeze does not allow the value of the property to simply be empty string ("") - it generates a validation error :

'MyProperty' is a required field

We recently changed from using Breeze.Sharp.Standard.Fork (it came with the Blazor project template we use) to Breeze.Sharp 0.9.1. This was not a problem in Breeze.Sharp.Standard.Fork but is a problem in Breeze.Sharp.

Oddly, for some properties we get the error even if, at the time of saving, the property does contain a non-empty value; in this case the problem arises if the dto that we are saving was not initialised with a non-empty string set for the property, even if the property is set to something afterwards. The fix for this situation is to initialise the property to " " or similar.

I can remedy the problem by ensuring that all such properties both contain a non-empty value and are initialised with a non-empty value, but this is a real drag...

Is this behaviour intentional in Breeze.Sharp, or something unintended?


Solution

  • There might be a good reason for this behavior, but it sounds unintentional.

    I'll need to look at the differences between Breeze.Sharp 0.9.1 and Breeze.Sharp.Standard.Fork and see why the behavior is different.

    Please submit an issue at https://github.com/Breeze/breeze.sharp/issues about this. Try to include more detail (sample code) about the odd case you described above. Thanks.