Merged
Conversation
# Conflicts: # lib/importer/backend.test.js
rossjones
reviewed
Jan 16, 2025
| // undefined values and maps then to "undefined", and converts any validation errors to warnings | ||
| exports.optionalType = (baseType) => { | ||
| return (inputValue) => { | ||
| if(inputValue !== undefined && inputValue != "") { |
Contributor
There was a problem hiding this comment.
Do we want/need to check for null as well?
rossjones
reviewed
Jan 16, 2025
| // Create a required version of an existing type, that reports an undefined or empty-string input value as an error | ||
| exports.requiredType = (baseType) => { | ||
| return (inputValue) => { | ||
| if(inputValue !== undefined && inputValue != "") { |
Contributor
There was a problem hiding this comment.
Dupe comment, null check?
rossjones
reviewed
Jan 16, 2025
rossjones
reviewed
Jan 16, 2025
rossjones
reviewed
Jan 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Added a validation mechanism, invoke by providing attribute type validators when setting up the import mapping.
If none are specified, it defaults to everything being strings with no validation, matching current behaviour.
The mapping results may now include errors that cause input rows to be rejected, or warnings where a row could be interpreted but there might be a problem with it (eg, an attribute value was malformed for the required type, but it was marked as optional anyway so we can live without it).
Adding support to display these warnings/errors in the frontend will be a separate bit of work.