Skip to content

Conversation

@mfiedorowicz
Copy link
Member

This pull request includes significant changes to the netbox_diode_plugin/api/views.py file. The changes focus on improving the handling of object types and serializers, adding new methods to manage nested options, and ensuring proper error handling.

Key changes include:

Improvements to object type handling:

  • Modified _get_object_type_model to return both object_content_type and its model class.
  • Updated various methods to use the returned model class from _get_object_type_model instead of directly accessing object_type_model. [1] [2] [3]

Enhancements to serializer methods:

  • Split _get_serializer into separate methods _get_serializer_to_create and _get_serializer_to_update for better readability and maintenance. [1] [2] [3]
  • Added _get_fields_to_find_existing_objects to handle nested options and specific object type fields.

Error handling and object existence checks:

  • Improved error handling for non-existent objects in _get_serializer_to_create, _get_serializer_to_update, and other related methods. [1] [2]
  • Added a check to skip creating an object if it already exists during the post method.

Minor adjustments:

  • Updated _get_index_class_fields to handle the TagIndex registration in the netbox_diode_plugin.
  • Added _add_nested_opts method to recursively add nested options to fields.

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
@github-actions
Copy link

github-actions bot commented Feb 17, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1434 1391 97% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
netbox_diode_plugin/api/views.py 93% 🟢
TOTAL 93% 🟢

updated for commit: b3196ac by action🐍

Copy link
Contributor

@leoparente leoparente left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mfiedorowicz mfiedorowicz merged commit dacbfd9 into feat-diode-data-plugin Feb 17, 2025
2 checks passed
@mfiedorowicz mfiedorowicz deleted the fix-apply-change-set-concurrency branch February 17, 2025 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants