Skip to content

Conversation

akos326
Copy link

@akos326 akos326 commented Oct 1, 2025

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.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

@akos326 thanks for the pull request! I put this in "ready for triage" and we'll likely talk about in next week during Triage Tuesday but I also did a little pre-review if you'd like to take a look. Thanks again! And for your work on the Java client! ❤️

+ alias
+ "/metadataLanguage");
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Strange. A number of tests are failing.

Screenshot 2025-10-01 at 09-27-58 IQSS-Dataverse-Develop-PR_PR-11857 #1 edu harvard iq dataverse api Jenkins Screenshot 2025-10-01 at 09-28-07 IQSS-Dataverse-Develop-PR_PR-11857 #1 test - testBagItExport Jenkins

Copy link
Member

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();
Copy link
Member

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.

Copy link
Author

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");
Copy link
Member

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.

Copy link
Author

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>> {
Copy link
Member

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? 🤔

Copy link
Author

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

Copy link
Member

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

Copy link
Author

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.

Copy link
Author

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!

@akos326 akos326 requested a review from pdurbin October 3, 2025 07:24
@ofahimIQSS ofahimIQSS added the Size: 3 A percentage of a sprint. 2.1 hours. label Oct 7, 2025
@ofahimIQSS ofahimIQSS moved this from Ready for Triage to Ready for Review ⏩ in IQSS Dataverse Project Oct 7, 2025
@cmbz cmbz added the FY26 Sprint 8 FY26 Sprint 8 (2025-10-08 - 2025-10-22) label Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 8 FY26 Sprint 8 (2025-10-08 - 2025-10-22) Size: 3 A percentage of a sprint. 2.1 hours.

Projects

Status: Ready for Review ⏩

Development

Successfully merging this pull request may close these issues.

Feature Request: Add a new API endpoint for querying the metadata language of a Dataverse collection

5 participants