Skip to content

Update Cognitive Services Mgmt. PS with the latest Cognitive Services Mgmt. SDK #5200

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

Merged
merged 12 commits into from
Jan 17, 2018

Conversation

felixwa
Copy link
Contributor

@felixwa felixwa commented Dec 29, 2017

  1. Apply Cognitive Services SDK 3.0.0.0
  2. Update NuGet refs

Description


This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.
  • The pull request does not introduce breaking changes (unless a major version change occurs in the assembly and module).

Testing Guidelines

  • Pull request includes test coverage for the included changes.
  • PowerShell scripts used in tests should do any necessary setup as part of the test or suite setup, and should not use hard-coded values for locations or existing resources.

Cmdlet Signature Guidelines

  • New cmdlets that make changes or have side effects should implement ShouldProcess and have SupportShouldProcess=true specified in the cmdlet attribute. You can find more information on ShouldProcess here.
  • Cmdlet specifies OutputType attribute if any output is produced - if the cmdlet produces no output, it should implement a PassThru parameter.

Cmdlet Parameter Guidelines

  • Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
  • Complex parameter types are discouraged - a parameter type should be simple types as often as possible. If complex types are used, they should be shallow and easily creatable from a constructor or another cmdlet.
  • Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.

1. Apply Cognitive Services SDK 3.0.0.0
2. Update NuGet refs
@felixwa
Copy link
Contributor Author

felixwa commented Dec 29, 2017

Hi reviewer, I guess that I need to bump the AssemblyVersion/AssemblyFileVersion in AssemblyInfo.cs but I'm not sure what the version it should be as I see your team controls that for every release. So let me know.

Revision to 0.9.1

@@ -55,7 +55,7 @@ public PSCognitiveServicesAccount(CognitiveServicesModels.CognitiveServicesAccou

public string Etag { get; private set; }

public ProvisioningState? ProvisioningState { get; private set; }
public string ProvisioningState { get; private set; }
Copy link
Contributor Author

@felixwa felixwa Dec 29, 2017

Choose a reason for hiding this comment

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

This is the only meaningful change introduced by new SDK (3.0.0.0) but I don't think it is breaking.
Added to BreakingChangeIssues.csv.

Copy link
Member

Choose a reason for hiding this comment

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

@felixwa This is a breaking change, right. As in, I could have had scripts with things like:

$account.ProvisioningState == [ProvisioningState]::Running

and such a script will now be broken. I think you need to adapt this type in PSCognitiveServicesAccount so that this is not broken. It is OK to add an additional string field and deprecate this field, but you will need to do some translation between the string field from the wire and this enumeration until the next breaking change release (build)

Copy link
Contributor Author

@felixwa felixwa Jan 8, 2018

Choose a reason for hiding this comment

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

@markcowl , the meaning of this PR is to introduce this change as we found we cannot enum all possible ProvisioningState so we changed the Swagger, SDK then this PS, change its type from an enum to a string.

I don't want to add back that enum in PS as it has gone in SDK also I cannot predicate possible values of that enum. If RP returns back a value not in the enum, PS throws an exception at client side.

Is there an option we wait "until the next breaking change release (build)"? If so we could wait but I really don't want to add that enum back in PS and only in PS.

@felixwa breaking changes are not allowed. You will need to make a powershell-specific fix for this one field, and you should be able to do this without throwing on the client side.

Downgrade Newtonsoft.Json 10->6 as 10 resutls in UT cases fail at buddy
build (though can pass at my local).
Downgrade NuGet refs in Test project as UT cases in buddy build keep
failing.
Add breaking changes into exception list.
Quote the breaking change exceptions.
Quote every field of BreakingCHangeIssues.csv
Quote columns of BreakingChangeIssues.csv
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
Copy link
Member

Choose a reason for hiding this comment

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

these should come from the common dependecies file

@@ -55,7 +55,7 @@ public PSCognitiveServicesAccount(CognitiveServicesModels.CognitiveServicesAccou

public string Etag { get; private set; }

public ProvisioningState? ProvisioningState { get; private set; }
public string ProvisioningState { get; private set; }
Copy link
Member

Choose a reason for hiding this comment

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

@felixwa This is a breaking change, right. As in, I could have had scripts with things like:

$account.ProvisioningState == [ProvisioningState]::Running

and such a script will now be broken. I think you need to adapt this type in PSCognitiveServicesAccount so that this is not broken. It is OK to add an additional string field and deprecate this field, but you will need to do some translation between the string field from the wire and this enumeration until the next breaking change release (build)

@@ -781,3 +781,6 @@
"Microsoft.Azure.Commands.Compute.dll","Microsoft.Azure.Commands.Compute.SetAzureVMCommand","Set-AzureRmVM","0","2080","The parameter 'Generalized' in parameter set 'GeneralizeIdParameterSetName' for cmdlet 'Set-AzureRmVM' no longer has the attribute 'ValueFromPipelineByPropertyName'.","Add the attribute 'ValueFromPipelineByPropertyName' back to parameter 'Generalized' in parameter set 'GeneralizeIdParameterSetName'."
"Microsoft.Azure.Commands.Compute.dll","Microsoft.Azure.Commands.Compute.SetAzureVMCommand","Set-AzureRmVM","0","2060","The position of parameter 'Redeploy' has changed for parameter set 'RedeployIdParameterSetName' for cmdlet 'Set-AzureRmVM'.","Revert the position change made to parameter 'Redeploy' for parameter set 'RedeployIdParameterSetName'."
"Microsoft.Azure.Commands.Compute.dll","Microsoft.Azure.Commands.Compute.SetAzureVMCommand","Set-AzureRmVM","0","2080","The parameter 'Redeploy' in parameter set 'RedeployIdParameterSetName' for cmdlet 'Set-AzureRmVM' no longer has the attribute 'ValueFromPipelineByPropertyName'.","Add the attribute 'ValueFromPipelineByPropertyName' back to parameter 'Redeploy' in parameter set 'RedeployIdParameterSetName'."
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.CognitiveServices\Microsoft.Azure.Commands.Management.CognitiveServices.dll","Microsoft.Azure.Commands.Management.CognitiveServices.GetAzureCognitiveServicesAccountCommand","Get-AzureRmCognitiveServicesAccount","0","3000","The type of property 'ProvisioningState' of type 'Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSCognitiveServicesAccount' has changed from 'System.Nullable`1[Microsoft.Azure.Management.CognitiveServices.Models.ProvisioningState]' to 'System.String'.","Change the type of property 'ProvisioningState' back to 'System.Nullable`1[Microsoft.Azure.Management.CognitiveServices.Models.ProvisioningState]'."
Copy link
Member

Choose a reason for hiding this comment

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

not allowed

Copy link
Member

Choose a reason for hiding this comment

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

@felixwa breaking changes are not allowed until the breaking change release. You will need to deprecate this field and adapt to the breaking change in the wire - likely by intrpoducing a new field to your output type, and providing the best available mapping in the existing enum property

@markcowl
Copy link
Member

markcowl commented Jan 5, 2018

@felixwa Also, please update changelog.md with these changes

Remove dlls exist in common dependencies
1. After disucssion with Mark, redefine Provisioning state in PS and
mark it as obsolete.
2. Log changes in Changelog.md
3. Revert changes in BreakingChangeIssues.csv
4. Revision to 0.9.1
Revert BreakingCHangeIssues.csv
@maddieclayton maddieclayton assigned markcowl and unassigned felixwa Jan 10, 2018
Update upcoming-breaking-changes.md
Update upcoming-breaking-changes.md 2
@markcowl markcowl removed their assignment Jan 17, 2018
@markcowl
Copy link
Member

@markcowl markcowl merged commit 3576e35 into Azure:preview Jan 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants