Fix EncryptionConfiguration JSON unmarshaling case sensitivity #25726
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Fixes #25725
Fixes EncryptionConfiguration unmarshaling failure when parsing actual Azure Data Factory REST API responses.
Issue
The
EncryptionConfigurationstruct fails to unmarshal JSON responses from the Azure Data Factory REST API due to case sensitivity mismatch in field names.Current Behavior:
KeyName,VaultBaseUrl,KeyVersionkeyName,vaultBaseUrl,keyVersionnilafter unmarshaling, even when CMK is configuredExpected Behavior:
The SDK should correctly unmarshal encryption configuration from API responses regardless of field name casing.
Root Cause
Mismatch between documentation and actual API:
keyName,vaultBaseUrl(camelCase)KeyName,VaultBaseUrl(PascalCase)Changes
Updated
EncryptionConfiguration.UnmarshalJSONinmodels_serde.goto accept both PascalCase and camelCase variants:Evidence
REST API Response (verified with
az rest):{ "properties": { "encryption": { "KeyName": "my-cmk-key", "VaultBaseUrl": "https://my-keyvault.vault.azure.com", "KeyVersion": "abc123..." } } }Testing
Tested with real Azure Data Factory instances configured with customer-managed keys. After this change, encryption configuration fields are correctly populated.
Note About Generated Code
This is a fix for generated code. I understand this file is managed by the codegen framework. The root cause may be:
I'm willing to help fix the proper source (Swagger spec or autorest template) if maintainers can provide guidance on the correct approach.
Checklist
models_serde.go(a generated file) as a temporary fix for a real-world API compatibility issue. Guidance on the proper long-term solution would be appreciated.models_serde.gotypically doesn't have dedicated unit tests.