Skip to content
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

All REST exposed config endpoint #9140

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

J4bbi
Copy link
Contributor

@J4bbi J4bbi commented Oct 23, 2023

References

Add references/links to any related issues or PRs. These may include:

Description

This PR adds a new REST endpoint that exposes all configuration variables that have been whitelisted (in config/modules/rest.cfg). It includes an integration test.

Instructions for Reviewers

Go to server/api/config/properties/search/exposed and verify that all config is listed.

I have not tested pagination for this endpoint as I am assuming it is handled by pageable.

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & integration tests). Exceptions may be made if previously agreed upon.
  • My PR passes Checkstyle validation based on the Code Style Guide.
  • My PR includes Javadoc for all new (or modified) public methods and classes. It also includes Javadoc for large or complex private methods.
  • My PR passes all tests and includes new/updated Unit or Integration Tests based on the Code Testing Guide.
  • If my PR includes new libraries/dependencies (in any pom.xml), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR modifies REST API endpoints, I've opened a separate REST Contract PR related to this change.
  • If my PR includes new configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

@J4bbi J4bbi added new feature interface: REST API v7+ REST API for v7 and later (dspace-server-webapp module) labels Oct 23, 2023
Copy link
Contributor

@paulo-graca paulo-graca left a comment

Choose a reason for hiding this comment

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

Thank you again @J4bbi for this contribution! I can see, when the Angular interface addresses it, we will notice improvements. And also thank you for fixing and improving the documentation!

I've just one single request that is to add java docs. The other suggestion I left you in a comment in the RestContract PR, I let you decide i you agree or not, it's just a matter of consistency.

@tdonohue I think we still should consider this PR in the current release.

* @param pageable pagination information
* @return all configuration properties as an array
*/
@SearchRestMethod(name = "exposed")
Copy link
Contributor

Choose a reason for hiding this comment

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

I've just left a comment on the RestContract. If you consider it, then this name should also be changed.

Copy link
Member

Choose a reason for hiding this comment

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

actually exposed is more close to other existing search method name (top for communities) but I'm ok with both isExposed than exposed as long as the rest implementation and the rest contract match

import org.junit.Test;

/**
* Integration Tests against the /api/config/properties/[property] endpoint
* Integration Tests against the /api/config/properties/[property] and
* /api/config/properties/search/exposed endpoints
Copy link
Contributor

Choose a reason for hiding this comment

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

same note as before

import org.hamcrest.Matcher;
import org.hamcrest.Matchers;

public class ConfigurationMatcher {
Copy link
Contributor

Choose a reason for hiding this comment

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

this class misses java docs

EDIT: I know that we decide not to have mandatory java comments on tests, but it helps to understand.

@tdonohue
Copy link
Member

tdonohue commented Nov 10, 2023

@paulo-graca and @J4bbi : Just to clarify, I'd be OK with this getting into 7.6.1. However, it is lower priority to me as it's not used (yet) by the User Interface -- so it's the start to a performance improvement, but isn't used yet.

I apologize but I haven't had any chance to test/review this as I'm still testing other bug fixes for the 7.6.1 release. However, if this gets +1 votes, we can still consider it for the 7.6.1 release (due next week). If it misses 7.6.1, then we should aim to get this added into both 7.6.2 (date uncertain) and 8.0 (due in April)

@paulo-graca
Copy link
Contributor

I can confirm that this PR is working and exposing properties
image

@J4bbi
Copy link
Contributor Author

J4bbi commented Nov 22, 2023

@paulo-graca , many thanks for your review and my apologies for the late reply

I have had to prioritise other work. I just wanted to confirm that I will respond to this as soon as possible but not sure when exactly. (same applies to DSpace/RestContract#240)

@abollini abollini self-requested a review February 8, 2024 15:52
Copy link
Member

@abollini abollini left a comment

Choose a reason for hiding this comment

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

Hi @J4bbi thanks for your contribution. I have left minor feedback inline, once solved it is ready to go imho

* @param pageable pagination information
* @return all configuration properties as an array
*/
@SearchRestMethod(name = "exposed")
Copy link
Member

Choose a reason for hiding this comment

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

actually exposed is more close to other existing search method name (top for communities) but I'm ok with both isExposed than exposed as long as the rest implementation and the rest contract match

ConfigurationMatcher.matchConfiguration("configuration.exposed.array.value")
)))
.andExpect(status().isOk());
}
Copy link
Member

Choose a reason for hiding this comment

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

can we add a check also using the admin token? the goal is to have a test that would protect us against future refactoring. In future we could allow admins to retrieve additional properties but this search method must exposed just the public values according to the rest contract

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interface: REST API v7+ REST API for v7 and later (dspace-server-webapp module) new feature
Projects
Status: 👀 Under Review
Development

Successfully merging this pull request may close these issues.

REST API serves configuration inefficiently
4 participants