Allow for required empty string enumerations #789
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, you cannot have a string schema property which is both required and has an enumeration list containing empty string. Empty strings are considered as failing required validation so even though it is a permissible value as defined by the enumeration it will still trigger a required validation failure. However, on output transformation, if an empty string is in the enumeration list, the output from mvom will be empty string instead of
null
.This PR modifies the required validation for strings so that if a property is required, it will not be considered an error if the value is present in the enumeration list, regardless of whether or not it is an empty string. This will allow empty strings to be defined for non-nullable fields and align the behavior more closely with the output transformation behavior for enumerations that contain empty strings.