-
Notifications
You must be signed in to change notification settings - Fork 495
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
JSON Schema creator and validator #10109
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@RequiredPermissions(Permission.AddDataset) | ||
public class ValidateDatasetJsonCommand extends AbstractCommand<String> { | ||
|
||
private static final Logger logger = Logger.getLogger(GetDatasetSchemaCommand.class.getCanonicalName()); |
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.
Copy-and-paste from the other command, probably.
I'm not seeing this discussed, in the pr or the linked issues - sorry if I missed it - but was there a specific reason to only use this validation code in the dedicated "validate" api? - and not always use it in the "create" api as well, before attempting to import the json uploaded by the user? |
This comment has been minimized.
This comment has been minimized.
I tested the build and endpoint, and everything went smoothly during installation/testing. The JSON schema I received was helpful, and I included a screenshot of the request and response for you to check out. I noticed that controlled vocabularies are missing. For instance, the |
This comment has been minimized.
This comment has been minimized.
@JR-1991 are you thinking the values themselves (Chemistry, Law, etc.) should be returned in the JSON Schema? That would certainly be more convenient than hitting another API to get them. Thanks again for adding that in this PR: Also, I'm wondering if this PR closes the following issue: It sounds so similar: "If this list [of five required fields] never changes, then RSpace could develop a solution where it reads a list of mandatory fields from a configuration file. But if it does change from time to time, it would be great if there was an API method in Dataverse to get a list of mandatory metadata fields .Then, a client could programmatically generate input fields for these properties so that the end-user could make a valid submission." I'll go ask. 😄 |
This comment has been minimized.
This comment has been minimized.
A good example of this is that the geospatial block expects floats for north, south, east, west (latitude and longitude). See this related pull request by @stevenwinship and @landreev merged yesterday: |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Sorry for missing your comment earlier. I believe this addition would be valuable and allow for client-side controlled vocabulary validation. |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
📦 Pushed preview images as
🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |
What this PR does / why we need it: Creates a custom json schema for a given Dataverse Collection that can be used to validate a dataset.json file prior to uploading to create the dataset
Which issue(s) this PR closes:
Closes #9464 Dataset json validation update code to use schema
Closes #9465 Create api.endpoint for Dataset json validation.
Closes #6978 Query Dataverse for mandatory metadata fields via API
Special notes for your reviewer: The api returns a json string that includes the escape characters. wasn't sure if that that is OK or if I should strip them out before returning
Suggestions on how to test this:
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Is there a release notes update needed for this change?: Release notes are included
Additional documentation: doc updated to include the new endpoints
https://dataverse-guide--10109.org.readthedocs.build/en/10109/api/native-api.html#retrieve-a-dataset-json-schema-for-a-collection