Skip to content

Remove circular dependency between entity and api schema #1990

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

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

Conversation

gfakbar20
Copy link
Contributor

This pr is made to remove the direct dependency of API schema in the entity class as mentioned in #780

@@ -981,7 +983,7 @@ public PrincipalWithCredentials createPrincipal(PolarisEntity entity) {
entity.getName());
}
return new PrincipalWithCredentials(
new PrincipalEntity(principalResult.getPrincipal()).asPrincipal(),
toPrincipal(new PrincipalEntity(principalResult.getPrincipal())),
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big fan of the static imports outside of test code

Copy link
Contributor

@eric-maynard eric-maynard left a comment

Choose a reason for hiding this comment

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

Overall this looks like a good change to me. I have one doubt after reading #780 though -- is it possible to actually remove the dependency after this change? As in, the gradle dependency?


public final class EntityConverter {

public static Catalog toCatalog(CatalogEntity entity) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this actually remove the circular dependency? The old CatalogEntity.asCatalog() method and this method do the same thing and exist in the case package 🤔

Copy link
Contributor

@flyrain flyrain left a comment

Choose a reason for hiding this comment

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

I didn't see any circular dependency in the code base. Here is the current dependency tree

  1. polaris-api-management-model depends no one
  2. polaris-core depends on polaris-api-management-model
  3. polaris-api-management-service depends on polaris-api-management-model and polaris-core.

@snazy
Copy link
Member

snazy commented Jul 4, 2025

This change is a very good step to remove the dependency of (low level) persistence concerns to (high level) API concerns, which can be, as you mentioned in the PR summary, considered a circular dependency. I do support this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants