eclipse-edc / eclipse-edc/Connector

rename `Operator.IN` to `Operator.IS_PART_OF`

Open
#5,105 1 comment 0 reactions 0 assignees View on GitHub
feature_request
Dominant language
Java
Stars
424
Forks
300
Avg merge
12h 19m
Merged PRs (30d)
37

Description

# Feature Request

The enum entry in `Operator` `IN` is bound to the ODRL operator `isPartOf`, this is misleading because when implementing policy functions that's not straightforward to undestand.
Renaming it to `IS_PART_OF` would be definitely better.

## Which Areas Would Be Affected?

`Operator` class

## Why Is the Feature Desired?

cleanup

## Solution Proposal

Unfortunately we cannot just rename it because the enum value is stored in all the policy definition stores around so a proposal would be:
1. add the correct `IS_PART_OF` entry in the enum, above `IN`, so it will be evaluated first when the method `Operator.values` is called
2. mark `IN` as deprecated
3. add warnings in the places where the `IN` is used as operator in constraint, that suggest the user to read and update the policy definition (with the update the policy have the correct enum entry because point 1.
4. Rename the `Operator` class to `OdrlOperator`, this will make things more explicit and it will also force adopters to change their code and being more aware about the `IN` deprecation, in case they missed it
5. mark the PR as `breaking change`, because adopters will need to change their policy function implementation to check for IN and IS_PART_OF in the same way.
Surely this is a lesson on why enums shouldn't be used lightly, especially in persistence :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.