-
-
Notifications
You must be signed in to change notification settings - Fork 107
Snake case conversion in Azure Key Vault #680
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
Snake case conversion in Azure Key Vault #680
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements mature snake case conversion for Azure Key Vault secret names, replacing the previous workaround solutions. The changes eliminate the need for manual field aliases and the dash_to_underscore parameter by automatically converting Key Vault naming conventions to Python snake_case.
- Automatic conversion from various naming patterns (camelCase, PascalCase, kebab-case) to snake_case
- Simplified field definitions by removing manual alias requirements
- Updated nested delimiter from '--' to '__' to match Python conventions
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pydantic_settings/sources/providers/azure.py | Implements snake case conversion using pydantic's to_snake function and removes case sensitivity options |
| tests/test_source_azure_key_vault.py | Updates test cases to remove field aliases and validates the new snake case conversion functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Thanks @AndreuCodina |
Until now, we had workarounds to read secrets from Azure Key Vault:
And Key Vault uses the dash for different semantics:
Now, the package implements a mature conversion, from Key Vault's semantics to the Python convention. For example, it converts the following secrets in Key Vault to Python:
With the old behavior, instead of converting to snake case, we had to add an alias and have mixed conventions in the .env file:
application_settings.py
.env