Skip to content

Conversation

@dominikriemer
Copy link
Member

@dominikriemer dominikriemer commented Oct 3, 2023

Purpose

Refactor adapter schema transformation logic:

  • Improve code structure
  • Cleanup transformation logic
  • Add capability to derive the original schema from transformation rules as a prerequisite for adapter modification (Better support modification of existing adapters #1960)
  • Fix an issue that occurred when adding a new nested field in the schema editor (no runtime name assigned to added field)
  • I also added a method getRulePriority to each transformation rule which determines the order of rule application, which was previously done implicitely.

Remarks

PR introduces (a) breaking change(s): no

PR introduces (a) deprecation(s): no

@github-actions github-actions bot added dependencies Pull requests that update a dependency file java Pull requests that update Java code ui Anything that affects the UI connect Related to the `connect` module (adapters) backend Everything that is related to the StreamPipes backend testing Relates to any kind of test (unit test, integration, or E2E test). labels Oct 3, 2023
@dominikriemer dominikriemer marked this pull request as ready for review October 3, 2023 18:48

@Override
public int getRulePriority() {
return 100;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we manage priorities somewhere centrally? E.g. via an enum?
With the current way it's hard to assess the individual priority value

Copy link
Contributor

Choose a reason for hiding this comment

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

If this is not possible, I would suggest that we add a small explanation somewhere in the JavaDoc (e.g. at the interface) that briefly explains the concept of rulePriority.

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks, I modified the code to provide all priorities from an enum


@Override
public void visit(CreateNestedRuleDescription rule) {

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why all the visit methods are emtpy?

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a comment to the empty methods to clearly state that the operation is skipped for stateless rules

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make the methods in this class none static? This is currently not critical, but if we change this, the clients that use the class should be easier to test. This comment also applies to the other Helper and Utils classes. We can also have a discussion about this.


@Override
public int getRulePriority() {
return 100;
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is not possible, I would suggest that we add a small explanation somewhere in the JavaDoc (e.g. at the interface) that briefly explains the concept of rulePriority.

@dominikriemer dominikriemer merged commit e680d47 into dev Oct 5, 2023
@dominikriemer dominikriemer deleted the refactor-adapter-transformation branch October 5, 2023 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Everything that is related to the StreamPipes backend connect Related to the `connect` module (adapters) dependencies Pull requests that update a dependency file java Pull requests that update Java code testing Relates to any kind of test (unit test, integration, or E2E test). ui Anything that affects the UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants