Skip to content

Conversation

@Eduguimar
Copy link

Closes #14016

This pull request refactors the API key validation for web fetchers by replacing the getTestUrl() method with a more flexible isValidKey(String apiKey) in the CustomizableKeyFetcher interface. This allows each fetcher to implement its own specific logic for key validation, instead of assuming the key is always appended to a URL. The implementation was updated for IEEE, BiodiversityLibrary, Medline, SpringerNature, and Unpaywall fetchers.

Steps to test

  1. Go to File -> Preferences -> Web search.
  2. In the "Web search fetchers" section, select a fetcher that requires an API key (e.g., IEEE Xplore).
  3. Check the option box and click in the "Configure API key" button.
  4. Enter the API key and click the "Test connection"" button.
  5. A confirmation dialog should appear if the key is valid, and an error dialog if it is invalid.
  6. Repeat the process for other updated fetchers like Biodiversity Heritage Library to confirm the validation works as expected.

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef (always required)
  • I added JUnit tests for changes (if applicable)
  • [/] I added screenshots in the PR description (if change is visible to the user)
  • I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • I checked the user documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2025

Hey @Eduguimar! 👋

Thank you for contributing to JabRef!

We have automated checks in place, based on which you will soon get feedback if any of them are failing.

After all automated checks pass, a maintainer will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs.

Please re-check our AI Usage Policy to ensure that your pull request is in line with it. It also contains links to our contribution guide in case of any other doubts related to our contribution workflow.

@github-actions github-actions bot added the status: changes-required Pull requests that are not yet complete label Dec 7, 2025
@calixtus calixtus changed the title Issue 14016 Separate fetcher key validation from fetcher api url Dec 8, 2025
- The URL integrity check now checks the complete URL syntax. [#14370](https://github.com/JabRef/jabref/pull/14370)
- <kbd>Tab</kbd> in the last text field of a tab moves the focus to the next tab in the entry editor. [#11937](https://github.com/JabRef/jabref/issues/11937)
- We changed fixed-value ComboBoxes to SearchableComboBox for better usability. [#14083](https://github.com/JabRef/jabref/issues/14083)
- We improved the API key validation for web fetchers by replacing the rigid `getTestUrl()` with a more flexible `isValidKey(String apiKey)` method. This makes the key validation more reliable. [#14016](https://github.com/JabRef/jabref/issues/14016)
Copy link
Member

Choose a reason for hiding this comment

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

Only userfacing changes to ui or behaviour should be documented in changelog. Please remove.

@calixtus calixtus added component: fetcher dev: code-quality Issues related to code or architecture decisions labels Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: fetcher dev: code-quality Issues related to code or architecture decisions first contrib status: changes-required Pull requests that are not yet complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rewrite org.jabref.logic.importer.fetcher.CustomizableKeyFetcher#getTestUrl to be a pattern

2 participants