Skip to content

Conversation

pheus
Copy link
Contributor

@pheus pheus commented Mar 22, 2025

Pull Request

Related Issue

Fixes: #249[Housekeeping] Use NetBoxObjectType for GraphQL

New Behavior

  • Replaced OrganizationalObjectType with NetBoxObjectType in GraphQL.
  • Removed the Meta class from GraphQL types.
  • Cleaned up the GraphQL codebase to align with NetBox best practices.
  • Allowed nullable source and destination ports in GraphQL.
  • Allowed nullable prefix fields in GraphQL types.

Contrast to Current Behavior

  • source_ports and destination_ports now support null values, ensuring compatibility when no ports are specified.
  • source_prefix and destination_prefix fields are now nullable, preventing errors when prefixes are not provided.

Discussion: Benefits and Drawbacks

  • The AccessList models inherit from NetBoxModel, which includes several feature mixins. These features were missing when using OrganizationalObjectType as the parent class in GraphQL. Switching to NetBoxObjectType ensures that all NetBox model features are properly available in GraphQL.

Changes to the Documentation

None required (behavior remains consistent with expected NetBox GraphQL functionality).

Proposed Release Note Entry

None required (internal improvement).

Double Check

  • I have explained my PR according to the information in the comments
    or in a linked issue.
  • My PR targets the dev branch.

pheus added 6 commits March 22, 2025 09:09
Refactor GraphQL module imports for clarity and consistency.
Updated formatting to adhere to code standards without modifying
functionality or behavior.

Fixes: netbox-community#249
Refactors AccessListType and related classes to use NetBoxObjectType.
This improves consistency by aligning with the updated base type in the
codebase. No functional changes introduced.

Fixes: netbox-community#249
Eliminates unnecessary Meta classes and associated GraphQL fields for
ACL models.

Fixes: netbox-community#249
Reordered GraphQL classes to follow the structure of their corresponding
NetBox models, improving consistency and maintainability.

Fixes: netbox-community#249
Updates the `source_ports` and `destination_ports` fields to support null
values. This ensures compatibility with cases where no ports are specified.

Fixes: netbox-community#249
Updates `source_prefix` and `destination_prefix` fields to be nullable.
This ensures compatibility with cases where prefixes may not be provided.

Fixes: netbox-community#249
@cruse1977 cruse1977 merged commit 4ea2c7c into netbox-community:dev Apr 20, 2025
6 checks passed
@pheus pheus deleted the housekeeping/249-use-netboxobjecttype-for-graphql branch April 20, 2025 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Housekeeping]: Use NetBoxObjectType for GraphQL
2 participants