Commit 1f1cb0c
Fix optional relationships preventing object template defaults from applying (#634)
* Initial plan
* Fix optional attributes not being set when using object templates
- Modified _generate_input_data() to skip adding None for optional relationships on new nodes
- For existing nodes, still include None to allow clearing relationships (preserves PR #515 behavior)
- Updated tests to reflect new behavior
- Added test to verify existing nodes still work correctly
Co-authored-by: minitriga <[email protected]>
* Add type annotations to test parameters and use BothClients fixture
- Added BothClients import to TYPE_CHECKING block
- Updated test_update_input_data_existing_node_with_optional_relationship to use clients fixture with proper type annotations
- Changed from client fixture to clients fixture (clients.standard and clients.sync)
- Added type annotation for client_type parameter
Co-authored-by: minitriga <[email protected]>
* Use __future__ annotations and add changelog for issue 630
- Added `from __future__ import annotations` to enable postponed evaluation
- Changed `clients: "BothClients"` to `clients: BothClients` without string quotes
- Moved GenericSchema, NodeSchemaAPI, and HTTPXMock imports to TYPE_CHECKING block
- Added changelog/630.fixed.md documenting the fix
Co-authored-by: minitriga <[email protected]>
* Fix linting: correct import path in TYPE_CHECKING block
Changed `from tests.unit.sdk.conftest import BothClients` to `from .conftest import BothClients` to fix ruff import sorting error after merge from stable branch.
Co-authored-by: minitriga <[email protected]>
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: minitriga <[email protected]>
Co-authored-by: Alex Gittings <[email protected]>1 parent eadf3f4 commit 1f1cb0c
File tree
3 files changed
+47
-7
lines changed- changelog
- infrahub_sdk/node
- tests/unit/sdk
3 files changed
+47
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
257 | 260 | | |
258 | 261 | | |
259 | 262 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
20 | | - | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| |||
1366 | 1371 | | |
1367 | 1372 | | |
1368 | 1373 | | |
1369 | | - | |
1370 | 1374 | | |
1371 | 1375 | | |
1372 | 1376 | | |
| |||
1394 | 1398 | | |
1395 | 1399 | | |
1396 | 1400 | | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
1397 | 1433 | | |
1398 | 1434 | | |
1399 | 1435 | | |
| |||
1642 | 1678 | | |
1643 | 1679 | | |
1644 | 1680 | | |
1645 | | - | |
| 1681 | + | |
1646 | 1682 | | |
1647 | 1683 | | |
1648 | 1684 | | |
| |||
1656 | 1692 | | |
1657 | 1693 | | |
1658 | 1694 | | |
1659 | | - | |
| 1695 | + | |
1660 | 1696 | | |
1661 | 1697 | | |
1662 | 1698 | | |
| |||
0 commit comments