Files
e52d7383a3 Fixes #567 - Add $items notation support to key_value_replace (#643)
## Description

The `$items` notation (e.g., `$items.Lakehouse.Sample_LH.$id`) was only
available in `find_replace` parameters. This PR extends support to
`key_value_replace`, enabling dynamic item references in JSON/YAML files
using JSONPath expressions.

### Changes

- **Modified `replace_key_value()` in `_utils.py`**: Process string
values through `extract_replace_value()` to handle `$items` notation,
reusing existing logic from `find_replace`
- **Added test coverage**: Two new tests verify `$items` notation works
correctly with string values while preserving existing behavior for
other types (boolean, integer, etc.)
- **Updated documentation**: Added examples using realistic DataPipeline
JSON structures with JSONPath targeting `notebookId` and `workspaceId`
properties in actual `pipeline-content.json` files, clarified that
dynamic replacement applies to both parameter types
- **Updated sample parameter file**: Changed example to use DataPipeline
item type with JSONPath targeting the "Run Hello World" pipeline
structure

### Example Usage

```yaml
key_value_replace:
    - find_key: $.properties.activities[?(@.name=="Run Notebook")].typeProperties.notebookId
      replace_value:
          PPE: "$items.Notebook.Hello World.$id"
          PROD: "$items.Notebook.Hello World.$id"
      item_type: "DataPipeline"
    - find_key: $.properties.activities[?(@.name=="Run Notebook")].typeProperties.workspaceId
      replace_value:
          PPE: "$workspace.$id"
          PROD: "$workspace.$id"
      item_type: "DataPipeline"
```

Supports the same attributes as `find_replace`: `$id`, `$sqlendpoint`,
`$queryserviceuri`, and all workspace variables.

## Linked Issue (REQUIRED)

Fixes #520

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Allow for using $items notation also in
key_value_replace</issue_title>
> <issue_description>### What is the feature?
> 
> The $items notation is really nice but currently it only works in
find_replace parameter definitions. It would be highly valuable if this
worked in the key_value_replace also.
> 
> ### Additional context
> 
> _No response_</issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> <comment_new><author>@shirasassoon</author><body>
> @celindho Thanks for providing this feedback. Happy to look into this.
> 
> I would like to get your thoughts, would you expect the same attribute
options (id, sqlendpoint, etc.) or could you see a need for any
additional attributes that would be required in the key_value_replace
scenario?</body></comment_new>
> </comments>
> 


</details>

- Fixes microsoft/fabric-cicd#567

<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for
you](https://github.com/microsoft/fabric-cicd/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: shirasassoon <66449905+shirasassoon@users.noreply.github.com>
Co-authored-by: Shira Sassoon <shirasassoon@microsoft.com>
2025-11-28 10:40:47 +02:00
..