GraphQL fails to show ProviderNetworks in Interface connected_endpoints #8958

Closed
opened 2025-12-29 20:43:21 +01:00 by adam · 2 comments
Owner

Originally created by @bogi788 on GitHub (Dec 13, 2023).

Originally assigned to: @arthanson on GitHub.

Deployment Type

Self-hosted

NetBox Version

v3.6.6

Python Version

3.11

Steps to Reproduce

When performing GraphQL queries on interfaces the connected_endpoints property fails to "expand" when connected to ProviderNetwork objects (via circuits).

Editing dcim/graphql/gfk_mixins.py and adding ProviderNetwork/ProviderNetworkType to LinkPeerType allows the query to succeed.

Expected Behavior

The GraphQL API should include all supported connected_endpoints types or the cable trace (for GraphQL) stop at the CircuitTermination that is already listed in the schema for LinkPeerType.

Observed Behavior

The query

query{
  interface_list(...) {
    id
    connected_endpoints{
      ... on CircuitTerminationType{
        id
      }
    }
  }
}

results in the following error message via the GraphQL API:

Abstract type 'LinkPeerType' must resolve to an Object type at runtime for field 'InterfaceType.connected_endpoints'. Either the 'LinkPeerType' type should provide a 'resolve_type' function or each possible type should provide an 'is_type_of' function.

Originally created by @bogi788 on GitHub (Dec 13, 2023). Originally assigned to: @arthanson on GitHub. ### Deployment Type Self-hosted ### NetBox Version v3.6.6 ### Python Version 3.11 ### Steps to Reproduce When performing GraphQL queries on interfaces the connected_endpoints property fails to "expand" when connected to ProviderNetwork objects (via circuits). Editing dcim/graphql/gfk_mixins.py and adding ProviderNetwork/ProviderNetworkType to LinkPeerType allows the query to succeed. ### Expected Behavior The GraphQL API should include all supported connected_endpoints types or the cable trace (for GraphQL) stop at the CircuitTermination that is already listed in the schema for LinkPeerType. ### Observed Behavior The query ``` query{ interface_list(...) { id connected_endpoints{ ... on CircuitTerminationType{ id } } } } ``` results in the following error message via the GraphQL API: `Abstract type 'LinkPeerType' must resolve to an Object type at runtime for field 'InterfaceType.connected_endpoints'. Either the 'LinkPeerType' type should provide a 'resolve_type' function or each possible type should provide an 'is_type_of' function.`
adam added the type: bugstatus: acceptedtopic: GraphQLseverity: low labels 2025-12-29 20:43:21 +01:00
adam closed this issue 2025-12-29 20:43:21 +01:00
Author
Owner

@jeremystretch commented on GitHub (Dec 15, 2023):

@Zaptho @pzoppoth @fstolba @anx-mpraxmarer @rwielk @Gaste8 you were all very quick to 👍 this issue. Would any of you like to volunteer to fix it?

@jeremystretch commented on GitHub (Dec 15, 2023): @Zaptho @pzoppoth @fstolba @anx-mpraxmarer @rwielk @Gaste8 you were all very quick to :+1: this issue. Would any of you like to volunteer to fix it?
Author
Owner

@bogi788 commented on GitHub (Dec 15, 2023):

https://github.com/bogi788/netbox/tree/14511-graphql-connected-endpoints contains the fix I've been using, but I'm unsure if adding a new type is the correct approach.

@bogi788 commented on GitHub (Dec 15, 2023): https://github.com/bogi788/netbox/tree/14511-graphql-connected-endpoints contains the fix I've been using, but I'm unsure if adding a new type is the correct approach.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8958