-
Notifications
You must be signed in to change notification settings - Fork 530
Metadata language api call #11857
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
base: develop
Are you sure you want to change the base?
Metadata language api call #11857
Conversation
Revert IQSS#11301 and bump version to 6.7.1
when cutting a release, base.image.version needs to be "revision" IQSS#11700
Merge the “develop” branch into “master” - 6.8 Release
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.
+ alias | ||
+ "/metadataLanguage"); | ||
} | ||
} |
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.
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.
I haven't investigated, but when :MetadataLanguages is set, I think datasets created via the API need to specify the metadataLanguage they use. So perhaps every test run after it's set is failing? If that's true, in addition to deleting the setting at the end of the test, the test may need to be annotated to not run in parallel with anything else (@ResourceLock(GLOBAL_TEST_LOCK)
?).
@Test | ||
public void testGetDataverseMetadataLanguage() { | ||
Response createUser = UtilIT.createRandomUser(); | ||
createUser.prettyPrint(); |
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.
I would suggest checking for OK or CREATED (I forget which) here.
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.
This part is pretty common in other test cases too. It would make sense to check for CREATED in all of them, but that's beyond the scope of this pull request, I think.
createUser.prettyPrint(); | ||
String username = UtilIT.getUsernameFromResponse(createUser); | ||
String apiToken = UtilIT.getApiTokenFromResponse(createUser); | ||
UtilIT.deleteSetting(":MetadataLanguages"); |
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.
This should also go in the @BeforeAll
setupClass and the @AfterAll
afterClass.
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.
Why isn't it enough to delete it in the beggining and end of the test case?
import edu.harvard.iq.dataverse.engine.command.DataverseRequest; | ||
import edu.harvard.iq.dataverse.engine.command.exception.CommandException; | ||
|
||
public class GetDataverseMetadataLanguageCommand extends AbstractCommand<Map<String, String>> { |
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.
I'm refreshing myself on how this feature even works by reading https://guides.dataverse.org/en/6.8/installation/config.html#allowing-the-language-used-for-dataset-metadata-to-be-specified
In this command we're doing a get. Is there a command or at least an API endpoint for doing a set? As of #7958 the docs above say that the metadata language can be configured per collection but is only possible via the UI? 🤔
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.
You're right, there's no API endpoint currently to set a metadata language in a collection. It's possible via the UI and Dataverse has a setter method
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.
Ok, thanks for confirming. Are you interested in expanding the scope of this pull request to include the setter method?
Also, it could be expanded, if you want, to include a getter for the :MetadataLanguages setting. Please see https://guides.dataverse.org/en/6.8/developers/api-design.html#exposing-settings
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.
Currently the GET method is sufficient for my purposes, but adding a POST doesn't seem to be much work. I'll do it tomorrow.
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.
Done, we have a PUT method now!
What this PR does / why we need it:
Adds a new API endpoint for querying the metadata language of a Dataverse collection.
Which issue(s) this PR closes:
Suggestions on how to test this:
Start a Dataverse instance and add some metadata languages as described here.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
No, only the API.
Is there a release notes update needed for this change?:
Yes, the documentation of this new API endpoint.