Skip to content

Conversation

@matthewyuh246
Copy link

@matthewyuh246 matthewyuh246 commented Dec 5, 2025

Purpose

Fixes #25725

Fixes EncryptionConfiguration unmarshaling failure when parsing actual Azure Data Factory REST API responses.

Issue

The EncryptionConfiguration struct fails to unmarshal JSON responses from the Azure Data Factory REST API due to case sensitivity mismatch in field names.

Current Behavior:

  • Azure Data Factory REST API returns encryption properties with PascalCase: KeyName, VaultBaseUrl, KeyVersion
  • SDK's UnmarshalJSON expects camelCase: keyName, vaultBaseUrl, keyVersion
  • Result: Encryption configuration fields remain nil after unmarshaling, even when CMK is configured

Expected Behavior:
The SDK should correctly unmarshal encryption configuration from API responses regardless of field name casing.

Root Cause

Mismatch between documentation and actual API:

Changes

Updated EncryptionConfiguration.UnmarshalJSON in models_serde.go to accept both PascalCase and camelCase variants:

case "keyName", "KeyName":
    err = unpopulate(val, "KeyName", &e.KeyName)
case "keyVersion", "KeyVersion":
    err = unpopulate(val, "KeyVersion", &e.KeyVersion)
case "vaultBaseUrl", "VaultBaseUrl":
    err = unpopulate(val, "VaultBaseURL", &e.VaultBaseURL)

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:

  1. Incorrect Swagger spec (should specify PascalCase to match actual API)
  2. Azure API inconsistency (should return camelCase as documented)

I'm willing to help fix the proper source (Swagger spec or autorest template) if maintainers can provide guidance on the correct approach.


Checklist

  • The purpose of this PR is explained in this or a referenced issue.
  • The PR does not update generated files.
    • Note: This PR intentionally modifies 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.
  • Tests are included and/or updated for code changes.
    • Note: Based on the repository pattern, models_serde.go typically doesn't have dedicated unit tests.
  • Updates to module CHANGELOG.md are included.
    • TODO: Will add if this approach is acceptable.
  • MIT license headers are included in each file.
    • Existing file modification, headers already present.

- Support both PascalCase and camelCase field names (KeyName/keyName, VaultBaseUrl/vaultBaseUrl)
- Add test cases for both formats
- Fixes issue where Azure API returns PascalCase but SDK expects camelCase

Addresses inconsistency between Azure Data Factory REST API response
(PascalCase) and Microsoft documentation (camelCase).
@github-actions github-actions bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. labels Dec 5, 2025
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Thank you for your contribution @matthewyuh246! We will review the pull request and get back to you soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Data Factory] EncryptionConfiguration JSON unmarshaling fails due to case-sensitive field names

1 participant