Skip to content

bug: cannot use a variable in the data property of IPPrefixPoolGetResourceInput input type used in the IPPrefixPoolGetResource GraphQL mutation #6850

Description

@wvandeun

Component

API Server / GraphQL

Infrahub version

1.3.3

Current Behavior

When you use a variable in the data property of the data argument used in the IPPrefixPoolGetResource GraphQL mutation, to set (for example) a description on the prefix created from the pool, then the value of the variable seems to be ignored and the description is left empty.

For example

mutation MyMutation($description: String!) {
  IPPrefixPoolGetResource( data: {
    id: "1808d319-b7e4-3bc8-d0ee-c5174bca9432",
    data: {
      description: $description
    }
  })
  {
    ok
    node {
      id
    }
  }
}

with variables

{"description": "description"}

will result in a new prefix object, without the description value being set.

Performing the mutation without using a variable works as expected:

mutation MyMutation {
  IPPrefixPoolGetResource( data: {
    id: "1808d319-b7e4-3bc8-d0ee-c5174bca9432",
    data: {
      description: "description"
    }
  })
  {
    ok
    node {
      id
    }
  }
}

Expected Behavior

The resulting prefix object, should have it's description attribute set to the value that we passed through the variable.

Steps to Reproduce

  • open the graphql sandbox in the sandbox instance
  • execute the following graphql mutation
mutation MyMutation($description: String!) {
  IPPrefixPoolGetResource( data: {
    hfid: ["External prefixes pool"],
    data: {
      description: $description
    }
  })
  {
    ok
    node {
      id
    }
  }
}

with the following variable

{"description": "description value"}
  • open the newly created object, notice that the description attribute has no value

Additional Information

A similar issue seems to happen when you use variables in the data property of the from_pool resolver in other mutations.

Metadata

Metadata

Assignees

Labels

group/backendIssue related to the backend (API Server, Git Agent)type/bugSomething isn't working as expected

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions