Commit 7dda581
fix: resolve panic when adding list entry before existing one (#1379)
The getDeletedItems (RESTCONF) and addDeletedItemsXML (NETCONF) template
functions had swapped loop indices when comparing list-type attributes
within list entries. When i iterates state and j is the matched index in
data, the code incorrectly read data[i] and state[j], causing an
index-out-of-range panic whenever j > len(state)-1 (i.e., a new entry
is inserted before an existing one).
Fixed at both nesting levels in both functions (4 sites total in
gen/templates/model.go). Affects iosxe_route_map, iosxe_crypto_pki,
iosxe_radius_server, and iosxe_system generated models.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AI-Generated: yes
AI-Tool: claude-code
AI-Model: opus-4.6
AI-Percent: 50
AI-Reason: fix swapped i/j indices in list-diff template1 parent 0337405 commit 7dda581
8 files changed
Lines changed: 155 additions & 152 deletions
File tree
- docs/guides
- gen/templates
- internal/provider
- templates/guides
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments