-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26296 from yifanz7/mergepreview
[Storage][Do Not Squash] Merge recent chanegs from main to Az.Storage-preview
- Loading branch information
Showing
94 changed files
with
1,654 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...aking-changes-in-generated-modules-due-to-codegen-tool-upgrade-from-v3-to-v4.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Breaking Changes in Generated Modules Due to AutoRest.PowerShell Upgrade from v3 to v4 | ||
|
||
We are moving forward with using the new version of the code generation tool, AutoRest.PowerShell v4, to take advantage of the features offered by the latest version. The redesign of the generated code to support new user requirements in this version inevitably introduces some breaking changes. | ||
|
||
Below, we list the potential breaking changes from the perspective of users that may occur when upgrading the code generation tool for Azure PowerShell modules. | ||
|
||
**Note: The breaking changes listed below may not apply universally to all generated modules. The occurrence of these breaking changes also depends on the specific configurations used when generating Azure PowerShell modules with AutoRest.PowerShell v4. For detailed information on which breaking changes may occur, please refer to the [breaking change list](https://learn.microsoft.com/powershell/azure/upcoming-breaking-changes) for the specific module.** | ||
|
||
## List Replaces Array in Generated C# Classes | ||
|
||
We now generate collection-like properties as [`List`](https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1) instead of [`Array`](https://learn.microsoft.com/en-us/dotnet/api/system.array) in the models. This is because `List` is dynamic that it allows appending/deleting elements, while `Array` is fixed-size hence difficult to edit. | ||
|
||
### How to Mitigate the Impact of Breaking Changes | ||
|
||
* "Use methods from List to replace methods from Array, for example: use count instead of Length to retrieve the number of elements | ||
* Use the ToArray function if conversion to a fixed-size array is needed | ||
|
||
## Use Primitive Types for Enum Instead of Struct | ||
|
||
We used to generate a struct for [enum](https://github.com/Azure/autorest/blob/main/docs/extensions/readme.md#x-ms-enum) to support tab completer for parameters. This design has been abandoned due to its limitation of only supporting enums with string type. | ||
|
||
### How to Mitigate the Impact of Breaking Changes | ||
|
||
Generally, this change will not cause a breaking change for users. In modules generated by older versions, users typically use primitive types, and the generated struct includes a converter that transforms these primitive types into the struct. The only requirement for users is to avoid using Microsoft.Azure.PowerShell.Cmdlets.{module}.Support.* directly. | ||
|
||
## Breaking Changes Due to Bug Fixes | ||
|
||
### Removal of PassThru for Certain Cmdlets | ||
|
||
`-PassThru` is a switch parameter that we add to cmdlets that don't have outputs to enable the pipline functionality. In AutoRest.PowerShell v3, `-PassThru` was incorrectly added to some cmdlets that do have outputs. This is fixed in v4 and those extra `-PassThru` parameters are removed. | ||
|
||
#### How to Mitigate the Impact of Breaking Changes | ||
|
||
Discontinue using the `PassThru` parameter for these cmdlets. Be careful that by doing so the output may change. | ||
|
||
### Removal of Readonly Parameters | ||
|
||
If a property is marked `"x-ms-mutability": ["read"]` in the OpenAPI spec, it means it should only appear in the output but never as an input parameter. However, in AutoRest.PowerShell v3, such kind of readonly parameters were incorrectly generated for cmdlets. | ||
|
||
#### How to Mitigate the Impact of Breaking Changes | ||
|
||
It's safe to simply remove these Readonly parameters, as they are ignored by the service. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.