-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Add autorest-generated model factories #21301
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Event Grid updates look good.
@@ -337,7 +337,9 @@ public static partial class FormRecognizerModelFactory | |||
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] | |||
public static Azure.AI.FormRecognizer.Training.CustomFormModel CustomFormModel(string modelId, Azure.AI.FormRecognizer.Training.CustomFormModelStatus status, System.DateTimeOffset trainingStartedOn, System.DateTimeOffset trainingCompletedOn, System.Collections.Generic.IReadOnlyList<Azure.AI.FormRecognizer.Training.CustomFormSubmodel> submodels, System.Collections.Generic.IReadOnlyList<Azure.AI.FormRecognizer.Training.TrainingDocumentInfo> trainingDocuments, System.Collections.Generic.IReadOnlyList<Azure.AI.FormRecognizer.Models.FormRecognizerError> errors) { throw null; } | |||
public static Azure.AI.FormRecognizer.Training.CustomFormModel CustomFormModel(string modelId, Azure.AI.FormRecognizer.Training.CustomFormModelStatus status, System.DateTimeOffset trainingStartedOn, System.DateTimeOffset trainingCompletedOn, System.Collections.Generic.IReadOnlyList<Azure.AI.FormRecognizer.Training.CustomFormSubmodel> submodels, System.Collections.Generic.IReadOnlyList<Azure.AI.FormRecognizer.Training.TrainingDocumentInfo> trainingDocuments, System.Collections.Generic.IReadOnlyList<Azure.AI.FormRecognizer.Models.FormRecognizerError> errors, string modelName, Azure.AI.FormRecognizer.Training.CustomFormModelProperties properties) { throw null; } | |||
public static Azure.AI.FormRecognizer.Training.CustomFormModelField CustomFormModelField(string name = null, float? accuracy = default(float?)) { throw null; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FR is in code freeze until we release GA (hopefully this week). Is there a way to disable the changes here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add an internal type that will make codegen MF internal. We will delete it after GA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class names need to be changed to match pattern, and the sample factory isn't necessary because it's a sample. These classes just complicate it unnecessarily. Can we just turn off factory generation?
...t/Azure.Security.KeyVault.Administration/src/Generated/KeyVaultAdministrationModelFactory.cs
Outdated
Show resolved
Hide resolved
using Azure.Security.KeyVault.Administration.Models; | ||
|
||
namespace Azure.Security.KeyVault.Administration | ||
{ | ||
/// <summary> | ||
/// A factory class which constructs model classes for mocking purposes. | ||
/// </summary> | ||
public static class KeyVaultAdministrationModelFactory | ||
[CodeGenType("AzureSecurityKeyVaultAdministrationModelFactory")] | ||
public static partial class KeyVaultAdministrationModelFactory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just AdministrationModelFactory
, which matches our other factory classes we already GA'd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type was there already. Do you want me to rename it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, wow, you're right. I didn't realize that (or just flat-out forgot). @christothes it seems to me that we should leave this name as-is since "AdministrationModelFactory" is rather vague, even if it fits the existing pattern. Agreed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Giving timing, we'll leave it as-is for now. If there's concern, we still have a little time to change it.
Is there anybody else who needs public API changes to be reverted in this PR? |
…Token doesn't throw NRE anymore.
public static partial class ContainerRegistryModelFactory | ||
{ | ||
public static Azure.Containers.ContainerRegistry.ArtifactManifestProperties ArtifactManifestProperties(string registryLoginServer = null, string repositoryName = null, string digest = null, long? size = default(long?), System.DateTimeOffset createdOn = default(System.DateTimeOffset), System.DateTimeOffset lastUpdatedOn = default(System.DateTimeOffset), Azure.Containers.ContainerRegistry.ArtifactArchitecture? architecture = default(Azure.Containers.ContainerRegistry.ArtifactArchitecture?), Azure.Containers.ContainerRegistry.ArtifactOperatingSystem? operatingSystem = default(Azure.Containers.ContainerRegistry.ArtifactOperatingSystem?), System.Collections.Generic.IReadOnlyList<Azure.Containers.ContainerRegistry.ArtifactManifestReference> manifestReferences = null, System.Collections.Generic.IReadOnlyList<string> tags = null, bool? canDelete = default(bool?), bool? canWrite = default(bool?), bool? canList = default(bool?), bool? canRead = default(bool?), string quarantineState = null, string quarantineDetails = null) { throw null; } | ||
public static Azure.Containers.ContainerRegistry.ArtifactManifestReference ArtifactManifestReference(string digest = null, Azure.Containers.ContainerRegistry.ArtifactArchitecture architecture = default(Azure.Containers.ContainerRegistry.ArtifactArchitecture), Azure.Containers.ContainerRegistry.ArtifactOperatingSystem operatingSystem = default(Azure.Containers.ContainerRegistry.ArtifactOperatingSystem)) { throw null; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we ever wanted to use EditorBrowsable Never here, would that get picked up on the creation methods automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you apply [EditorBrowsable(EditorBrowsableState.Never)]
and [Browsable(false)]
to the hand-written partial part of the factory, it should affect all the methods in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACR looks good - thanks!
Actually, KV is about to GA in a couple weeks, so if that's an option, yes, I'd rather not take these changes. That also gives us time to work out the issues. I still think dropping the redundant class name from the class summary should go in before this one (or soon after, though). It's currently out of sync with the class name, and really is redundant since it's literally in the class summary. |
- Remove unwanted model factories
We have added assembly-level attribute @heaths, codegen'ed model factories are removed. |
using Azure.Security.KeyVault.Administration.Models; | ||
|
||
namespace Azure.Security.KeyVault.Administration | ||
{ | ||
/// <summary> | ||
/// A factory class which constructs model classes for mocking purposes. | ||
/// </summary> | ||
public static class KeyVaultAdministrationModelFactory | ||
[CodeGenType("AzureSecurityKeyVaultAdministrationModelFactory")] | ||
public static partial class KeyVaultAdministrationModelFactory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, wow, you're right. I didn't realize that (or just flat-out forgot). @christothes it seems to me that we should leave this name as-is since "AdministrationModelFactory" is rather vague, even if it fits the existing pattern. Agreed?
sdk/keyvault/Azure.Security.KeyVault.Administration/src/Properties/AssemblyInfo.cs
Outdated
Show resolved
Hide resolved
using Azure.Security.KeyVault.Administration.Models; | ||
|
||
namespace Azure.Security.KeyVault.Administration | ||
{ | ||
/// <summary> | ||
/// A factory class which constructs model classes for mocking purposes. | ||
/// </summary> | ||
public static class KeyVaultAdministrationModelFactory | ||
[CodeGenType("AzureSecurityKeyVaultAdministrationModelFactory")] | ||
public static partial class KeyVaultAdministrationModelFactory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Giving timing, we'll leave it as-is for now. If there's concern, we still have a little time to change it.
Fixes #21144