[App Config] az appconfig kv set/import: Add support for JSON comments#32130
[App Config] az appconfig kv set/import: Add support for JSON comments#32130zhoxing-ms merged 17 commits intoAzure:devfrom
az appconfig kv set/import: Add support for JSON comments#32130Conversation
…fori/strip_comments
…fori/strip_comments
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for stripping JSON comments when setting or importing key-value pairs with JSON content type in Azure App Configuration. The enhancement allows JSON with both single-line (//) and multi-line (/* */) comments to be processed by automatically stripping the comments before validation and storage.
- Implements a
strip_json_commentsutility function to remove comments from JSON strings - Modifies the key-value set operation to strip comments when JSON validation fails initially
- Updates the import functionality to handle JSON files containing comments
Reviewed Changes
Copilot reviewed 7 out of 32 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test_appconfig_json_content_type.py | Adds unit tests for JSON comment stripping functionality |
| test_azconfig_user_token_audience.yaml | Updates test recording with new timestamps and configuration |
| json_with_comments_stripped.json | Test fixture containing clean JSON without comments |
| json_with_comments.json | Test fixture containing JSON with both single-line and multi-line comments |
| keyvalue.py | Adds __normalize_json_input function to handle JSON comment stripping during kv set operations |
| _utils.py | Implements the core strip_json_comments function with comment removal logic |
| _kv_import_helpers.py | Updates JSON file parsing to support comments during import operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 7 out of 32 changed files in this pull request and generated 6 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| return index | ||
|
|
||
| def __find_next_double_quote_index(json_string, start_index): |
There was a problem hiding this comment.
These helper functions lack docstrings explaining their parameters, return values, and potential exceptions. Add comprehensive docstrings for better code documentation.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 7 out of 32 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Just curious, in portal we don't allow comments for key-vault reference, AI config and Feature flags do we do the same for CLI? |
Good call out. This has been updated to exclude KeyVault refs, feature flags and AI Config as is in portal. Kindly let me know if I am missing any other content type. Thanks! |
|
@zhoxing-ms , @yanzhudd , Could you please take a look at this PR and help merge it. We would want this to go with the current release window |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
az appconfig kv set/import: Add support for JSON commentsaz appconfig kv set/import: Add support for JSON comments
|
License check: @microsoft-github-policy-service rerun |
|
Hi @yanzhudd , Please I just pushed the change to add the license text at the beginning of the new file. Thanks! |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
az appconfig kv set/import: Add support for JSON commentsaz appconfig kv set/import: Add support for JSON comments
Related command
appconfig kv setappconfig kv importDescription
Adds support for stripping comments when writing a kv which is of json content type and might have comments. This is also done for import from a json file.
Testing Guide
History Notes
{App Config}
az appconfig kv set/import: Add support for JSON commentsThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.