Skip to content

Wrong data type for some GraphQL fields #19361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
corubba opened this issue Apr 29, 2025 · 1 comment · Fixed by #19373
Closed

Wrong data type for some GraphQL fields #19361

corubba opened this issue Apr 29, 2025 · 1 comment · Fixed by #19373
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Milestone

Comments

@corubba
Copy link
Contributor

corubba commented Apr 29, 2025

Deployment Type

Self-hosted

NetBox Version

v4.2.6

Python Version

3.12

Steps to Reproduce

  1. Open the GraphQL page and execute the following query:
{
  console_port_template_list {
    name
  }
  module_type_list {
    consoleporttemplates {
      name
    }   
  }
}

Expected Behavior

I receive a response with a list of all (if any) console-port-templates and module-types and no errors. This is an example from an empty v3.7.8 instance:

{
  "data": {
    "console_port_template_list": [],
    "module_type_list": []
  }
}

Observed Behavior

I receive the following response/error:

{
  "data": null,
  "errors": [
    {   
      "message": "Cannot query field 'name' on type 'ModuleType'.",
      "locations": [
        {
          "line": 7,
          "column": 7
        }
      ]   
    }   
  ]
}

Note that the error line is in the module_type_list query, not console_port_template_list.


I traced this back to the GraphQL-Engine-Change in v4.0.0, specifically 45c99e44. And because "if it happens once, it may happened twice" I wrote a quick script to compare the field types between the old and new engine, and found a few more suspicious looking ones:

Type IKEPolicyType    Field ipsec_profiles       data-type changed from LIST[IPSecProfileType]        to LIST[IPSecProposalType]
Type ManufacturerType Field device_types         data-type changed from LIST[DeviceTypeType]          to LIST[DeviceType]
Type ManufacturerType Field module_types         data-type changed from LIST[ModuleTypeType]          to LIST[ModuleType]
Type ModuleTypeType   Field consoleporttemplates data-type changed from LIST[ConsolePortTemplateType] to LIST[ModuleType]
Type ModuleTypeType   Field instances            data-type changed from LIST[ModuleType]              to LIST[InterfaceType]
Type ModuleTypeType   Field powerporttemplates   data-type changed from LIST[PowerPortTemplateType]   to LIST[PowerOutletTemplateType]

I would be happy to create a PR for this.

@corubba corubba added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Apr 29, 2025
@bctiemann bctiemann added status: accepted This issue has been accepted for implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: needs triage This issue is awaiting triage by a maintainer labels May 1, 2025
@bctiemann
Copy link
Contributor

Thanks @corubba !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants