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

chor: Improve the code quality of the Registry class #55

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AayushSaini101
Copy link
Contributor

Description

Improve the code quality of the Registry class for the pushArtificatMethod()

Related #50.

Testing done

### Submitter checklist
- [x] If an issue exists, it is well described and linked in the description
- [x] The description of this pull request is detailed and explain why this pull request is needed
- [ ] The changeset is on a specific branch. Using `feature/` for new feature, or improvements ; Using `fix/` for bug fixes ; Using `docs/` for any documentation changes.
- [ ] If required, the documentation has been updated
- [ ] There is automated tests to cover the code change / addition or an explanation why there is no tests in the description.

Copy link
Collaborator

@jonesbusy jonesbusy left a comment

Choose a reason for hiding this comment

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

Hi,

Thanks for your PR.

But I don't see how it will be an improvement. API usage is much more complicated. Passing some class via new, arrays instead of varagrs etc....

I would prefer to focus more on implementing OCI feature life referral.

There are also tasks related to release and publishing that are more priority so that user can consume the library easily.

I will put this PR on hold.

@@ -184,7 +184,7 @@ void testShouldPushAndPullMinimalArtifact() throws IOException {
Files.writeString(file1, "foobar");

// Upload
Manifest manifest = registry.pushArtifact(containerRef, file1);
Manifest manifest = registry.pushArtifact(new Registry.PushArtifactBuilder(containerRef, file1));
Copy link
Collaborator

Choose a reason for hiding this comment

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

For me it's far from an improvement passing some object via new.

private String artifactType = null; // Optional parameter
private Annotations annotations = Annotations.empty(); // Default value
private Config config = Config.empty(); // Default value
private Path[] paths; // Required parameter
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not hood for user experience

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay thanks

public Manifest pushArtifact(
ContainerRef containerRef, String artifactType, Annotations annotations, Path... paths) {
return pushArtifact(containerRef, artifactType, annotations, Config.empty(), paths);
public Manifest pushArtifact(PushArtifactBuilder builder) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't it be private ?

private Path[] paths; // Required parameter

// Constructor for required fields
public PushArtifactBuilder(ContainerRef containerRef, Path... paths) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't it be private?

}

// Setter for config
public PushArtifactBuilder withConfig(Config config) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't it be private?

@AayushSaini101
Copy link
Contributor Author

Hi,

Thanks for your PR.

But I don't see how it will be an improvement. API usage is much more complicated. Passing some class via new, arrays instead of varagrs etc....

I would prefer to focus more on implementing OCI feature life referral.

There are also tasks related to release and publishing that are more priority so that user can consume the library easily.

I will put this PR on hold.

Thanks @jonesbusy In that case, i will start working on the proper roadmap tasks of the oras-java #11

@jonesbusy
Copy link
Collaborator

Also perhaps what we miss is clear API? What we expose as public methods. What is implementation details etc...

@jonesbusy jonesbusy marked this pull request as draft January 29, 2025 10:38
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.

2 participants