[PR #12013] [CLOSED] 11617 validate csv column headers #13889

Closed
opened 2025-12-29 23:21:22 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/12013
Author: @arthanson
Created: 3/20/2023
Status: Closed

Base: developHead: 11617-csv-bulk-validation


📝 Commits (10+)

  • ef33aa9 11617 validate csv column headers
  • 18b98e6 11617 validate bulk import fields
  • 702cfc1 11617 validate bulk import fields
  • f7b3dad 11617 update header processing for related fields
  • a9f62c2 11617 update header processing for related fields
  • f46ac8b 11617 update header processing for related fields
  • b415c15 11617 fix header field dupe test
  • b8d7c8b 11617 special case DeviceType and ModuleType
  • 5346583 11617 add tests for yaml, json bulk import
  • 1f410cf 11617 add tests for invalid headers to csv,yaml,json

📊 Changes

5 files changed (+513 additions, -28 deletions)

View changed files

📝 netbox/netbox/tests/test_import.py (+222 -2)
📝 netbox/netbox/views/generic/bulk_views.py (+19 -1)
📝 netbox/utilities/forms/forms.py (+1 -0)
📝 netbox/utilities/forms/utils.py (+27 -18)
📝 netbox/utilities/testing/views.py (+244 -7)

📄 Description

Fixes: #11617

Refactors the bulk import code to use common validation of headers for csv, yaml and json - this is done on each line item as yaml and json have separate headers on each item. The validation for fields that aren't in the form is skipped for (DeviceTypeImportForm, ModuleTypeImportForm) as these allow importing of related objects.

Extra tests were added to test yaml and json bulk import along with the existing csv bulk import tests, as well as test for invalid field in the import.

Note: #13500 will need to be merged before this to fix the failing test.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/12013 **Author:** [@arthanson](https://github.com/arthanson) **Created:** 3/20/2023 **Status:** ❌ Closed **Base:** `develop` ← **Head:** `11617-csv-bulk-validation` --- ### 📝 Commits (10+) - [`ef33aa9`](https://github.com/netbox-community/netbox/commit/ef33aa9fce5669dd654a74f0b7920512658609f9) 11617 validate csv column headers - [`18b98e6`](https://github.com/netbox-community/netbox/commit/18b98e641c19be187a01cf991a0e5cf35a754028) 11617 validate bulk import fields - [`702cfc1`](https://github.com/netbox-community/netbox/commit/702cfc1fac2ca55528dc0d7a30c5aa87595c1559) 11617 validate bulk import fields - [`f7b3dad`](https://github.com/netbox-community/netbox/commit/f7b3dad29cc9134300064541471309f28e2b44a2) 11617 update header processing for related fields - [`a9f62c2`](https://github.com/netbox-community/netbox/commit/a9f62c2e6e27008abe77db779d70991595e58bbe) 11617 update header processing for related fields - [`f46ac8b`](https://github.com/netbox-community/netbox/commit/f46ac8b06a5dc8bbd42713f1bd3220709aa70906) 11617 update header processing for related fields - [`b415c15`](https://github.com/netbox-community/netbox/commit/b415c157cce81ac244053961a0bfec021dbf1689) 11617 fix header field dupe test - [`b8d7c8b`](https://github.com/netbox-community/netbox/commit/b8d7c8bc0d5c99f2d4e950c0eeedd38240633f52) 11617 special case DeviceType and ModuleType - [`5346583`](https://github.com/netbox-community/netbox/commit/5346583ccccc73aea4bce702e6d26ae33ce57007) 11617 add tests for yaml, json bulk import - [`1f410cf`](https://github.com/netbox-community/netbox/commit/1f410cf35a3f6a684facbf3722e4307f9a545cf4) 11617 add tests for invalid headers to csv,yaml,json ### 📊 Changes **5 files changed** (+513 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `netbox/netbox/tests/test_import.py` (+222 -2) 📝 `netbox/netbox/views/generic/bulk_views.py` (+19 -1) 📝 `netbox/utilities/forms/forms.py` (+1 -0) 📝 `netbox/utilities/forms/utils.py` (+27 -18) 📝 `netbox/utilities/testing/views.py` (+244 -7) </details> ### 📄 Description ### Fixes: #11617 Refactors the bulk import code to use common validation of headers for csv, yaml and json - this is done on each line item as yaml and json have separate headers on each item. The validation for fields that aren't in the form is skipped for (DeviceTypeImportForm, ModuleTypeImportForm) as these allow importing of related objects. Extra tests were added to test yaml and json bulk import along with the existing csv bulk import tests, as well as test for invalid field in the import. **Note:** #13500 will need to be merged before this to fix the failing test. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:21:22 +01:00
adam closed this issue 2025-12-29 23:21:22 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13889