SAP / SAP/btp-environment-variable-access
Feat: Introduce API for Searching (nested) Service Binding Properties
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 24
- Forks
- 13
- Avg merge
- 4h 35m
- Merged PRs (30d)
- 5
Description
Context
The current API (ServiceBinding and TypedMapView) allows only for getting direct (i.e. non-nested) properties.
To get a nested property, currently something like the following is needed:
final ServiceBinding serviceBinding;
final TypedMapView mapView = TypedMapView.of(serviceBinding);
final String
propertyValue =
mapView.getMapView("key1").getMapView("key2").getListView("key3").getMapView(2).getString("key4");
This style of accessing nested properties imposes following problems:
- The exact structure of the Service Binding must be know
- The access is very verbose and not very well readable
Request
Consider introducing a new API that allows searching for specific properties.
Suggestions
An API for the TypedMapView could look like this:
public <T> Collection<T> find(@Nonnull final Class<? extends T> entryType, @Nonnull final String entryKeyPattern );
public <T> Optional<T> findFirst( @Nonnull final Class<? extends T> entryType, @Nonnull final String entryKeyPattern );
One could also consider adding extra API for primitive return types:
public int findInteger( @Nonnull final String entryKeyPattern ) throws KeyNotFoundException;
Questions
- Where should we introduce such a new API (
ServiceBindingvs.TypedMapView) - Do we want to support some sort path matching?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing ServiceBinding and TypedMapView APIs and compare their current direct-property access with the nested example in the issue. Resolve where searching belongs, define the supported key-pattern behavior and return types, and treat the work as complete when the proposed API and its expected behavior are agreed and implemented with coverage for nested searches.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100