[Storage Account] Fix for issue #59323 - #59438
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #59323 in Azure.ResourceManager.Storage by making StorageAccountResourceAccessRule.TenantId deserialization tolerant of empty/whitespace/invalid GUID strings returned by the service, preventing GET/list operations from failing due to malformed tenantId values.
Changes:
- Added a TypeSpec customization deserialization hook to safely parse
tenantIdintoGuid?(fallback tonullon invalid input). - Updated generated model deserialization to use the new hook.
- Added NUnit tests covering valid/empty/whitespace/null/invalid
tenantIdJSON inputs and documented the fix in the changelog.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sdk/storage/Azure.ResourceManager.Storage/tests/Tests/StorageAccountResourceAccessRuleSerializationTests.cs | Adds coverage to ensure deserialization is tolerant to empty/invalid tenantId values. |
| sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/StorageAccountResourceAccessRule.Serialization.cs | Switches tenantId parsing to the customization hook to avoid exceptions on malformed values. |
| sdk/storage/Azure.ResourceManager.Storage/src/Customize/Models/StorageAccountResourceAccessRule.cs | Introduces DeserializeNullableGuid hook via CodeGenSerialization to safely parse tenantId. |
| sdk/storage/Azure.ResourceManager.Storage/CHANGELOG.md | Records the bug fix under the current unreleased version. |
Dapeng Zhang (ArcturusZhang)
left a comment
There was a problem hiding this comment.
Emm this change would cause the SDK to omit the value returned by the service if it is not really a guid.
Given the property name tenantId, I think we could be confident that this is a case that the service returns an empty string here, not returning some random string values.
If it is the later case, this fix is not quite good and instead we should create a new property with string type to hold the real value.
Anyhow, this LGTM
Wei Wei (blueww)
left a comment
There was a problem hiding this comment.
LGTM
The fix is aligned with another fix for same GUID parse issue before #56904. That fix works well for customer and don't take an regression customer issue.
* Fix * Update StorageAccountResourceAccessRule.cs
Contributing to the Azure SDK
Please see our CONTRIBUTING.md if you are not familiar with contributing to this repository or have questions.
For specific information about pull request etiquette and best practices, see this section.