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

[ContainerRegistry] beta.4 minor fixes #15722

Merged
merged 5 commits into from
Jun 16, 2021

Conversation

jeremymeng
Copy link
Member

  • UpdateManifestPropertiesOptions should not be optional
  • Improve ref doc comments for listing method
  • Fix ref doc for getRepository()
  • Remove dependency on @azure/core-util

Copy link
Member

@maorleger maorleger left a comment

Choose a reason for hiding this comment

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

🚀 Was curious about removing core-util but it's mostly for my own work

@@ -84,7 +85,6 @@
"@azure/core-rest-pipeline": "1.1.0-beta.4",
"@azure/core-paging": "^1.1.1",
"@azure/core-tracing": "1.0.0-preview.11",
"@azure/core-util": "^1.0.0-beta.1",
Copy link
Member

@maorleger maorleger Jun 16, 2021

Choose a reason for hiding this comment

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

I'm moving Key Vault to corev2 so figured it'll be useful info for me too - is there a reason not to use core-util? Like should I also make local copies of the methods I need from it? I think there's only like 2 functions there.

Copy link
Member Author

Choose a reason for hiding this comment

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

core-util is till in beta and we still want some investigation. I am copying code for now so ACR GA isn't blocked on core-util beta version. We can move to core-util after it is in GA.

@jeremymeng
Copy link
Member Author

@xirzec @chradek Does the api change look good?

Copy link
Member

@xirzec xirzec left a comment

Choose a reason for hiding this comment

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

I'm not opposed to the change, but I am curious about how this API works

@@ -208,7 +208,7 @@ export interface RegistryArtifact {
listTagProperties(options?: ListTagPropertiesOptions): PagedAsyncIterableIterator<ArtifactTagProperties>;
readonly registryEndpoint: string;
readonly repositoryName: string;
updateManifestProperties(options?: UpdateManifestPropertiesOptions): Promise<ArtifactManifestProperties>;
updateManifestProperties(options: UpdateManifestPropertiesOptions): Promise<ArtifactManifestProperties>;
Copy link
Member

Choose a reason for hiding this comment

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

Why are we making this non-optional when all of the keys are optional? Do one of the props have to be true?

Copy link
Member Author

@jeremymeng jeremymeng Jun 16, 2021

Choose a reason for hiding this comment

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

It doesn't make sense to not pass anything to the update method. The properties are optional to allow update one of them without having to specify all of them. Is it better to make it optional then no-op when nothing/empty object is passed in?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think you're right to make this required, just as a hint that they should do something.

As an aside, I spent some time getting TS magic for 'at least one of these properties should be on this object':

type AtLeastOne<Type> =
    {
        [Property in keyof Type]: Required<Pick<Type, Property>> & Partial<Type>
    }[keyof Type]

It works and does the right thing, but I think it's overkill for this. Maybe it'll be useful in a different place.

Co-authored-by: Maor Leger <maorleger@users.noreply.github.com>
Copy link
Member

@xirzec xirzec left a comment

Choose a reason for hiding this comment

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

You convinced me! 😄

@@ -208,7 +208,7 @@ export interface RegistryArtifact {
listTagProperties(options?: ListTagPropertiesOptions): PagedAsyncIterableIterator<ArtifactTagProperties>;
readonly registryEndpoint: string;
readonly repositoryName: string;
updateManifestProperties(options?: UpdateManifestPropertiesOptions): Promise<ArtifactManifestProperties>;
updateManifestProperties(options: UpdateManifestPropertiesOptions): Promise<ArtifactManifestProperties>;
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think you're right to make this required, just as a hint that they should do something.

As an aside, I spent some time getting TS magic for 'at least one of these properties should be on this object':

type AtLeastOne<Type> =
    {
        [Property in keyof Type]: Required<Pick<Type, Property>> & Partial<Type>
    }[keyof Type]

It works and does the right thing, but I think it's overkill for this. Maybe it'll be useful in a different place.

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.

3 participants