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

Allow for required empty string enumerations #789

Merged
merged 2 commits into from
Sep 23, 2024

Conversation

shawnmcknight
Copy link
Member

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.

Copy link
Contributor

@philfuster philfuster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@shawnmcknight shawnmcknight merged commit d1de631 into main Sep 23, 2024
4 checks passed
@shawnmcknight shawnmcknight deleted the required-validation-empty-string-enum branch September 23, 2024 14:57
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

Successfully merging this pull request may close these issues.

2 participants