-
Notifications
You must be signed in to change notification settings - Fork 2
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
License file and datacite value validation #55
Merged
Merged
Conversation
This file contains 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
Fail with error both at the preparation and the request stage. Link to new help page with information about licensing and links to license documents.
Takes care of URL path escaping.
This wont work for most variations, but it's a start.
Check if keys with limited choice of values contain a valid value.
Order functions based on request flow. Makes the file easier to navigate... sort of.
The datacite.yml is read, parsed/unmarshalled and validated at two points in the registration flow: During request preparation and after the request is submitted. A lot of code was duplicated for these two parts to manage logging and error reporting separately, but it's much cleaner and easier to work with if we have a single function that manages both. The user-friendly error message is returned from the new function and can be displayed on the page immediately. More detailed error logging happens inside the function.
Comparison is still made case insensitively.
mpsonntag
approved these changes
Sep 10, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice PR
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.
Validation
License
Restricted value selection
The datacite.yml keys
ResourceType
and referenceRefType
can only take a small number of values. These are listed in the instructional comments of the datacite.yml template. With this PR, the values are also checked during preparation and submission and if they're not valid, the allowed values are shown to the user.Code quality
This PR also includes a lot of reshuffling of code. I've moved functions around to different files to better separate them by purpose. They're all still in the same package though.
Some validation flow that was duplicated in both the preparation and submission phases has been converted to a function that's called in both cases.
The project should be much easier to navigate in general now.