Giter Site home page Giter Site logo

Comments (3)

jathanism avatar jathanism commented on May 28, 2024 3

In this particular case, it appears that the devices.role filter is filtering on the Device.device_role.slug field and not the name field:

To illustrate this, I attempted a filter on Backbone and got the unfiltered results, which IMO is not the expected behavior if the filter parameter is incorrect. You'd think it would return no matches instead of all?

Query on Backbone:

{
  devices(role: "Backbone"){
    id
    name
    device_role {
      name
      slug
    }
  }
}

Result (first item only):

{
  "data": {
    "devices": [
      {
        "id": "60833d08-7bdd-4b40-a8c4-33c1984ccc90",
        "name": "ams-edge-01",
        "device_role": {
          "name": "edge",
          "slug": "edge"
        }
      },

Then I did it with backbone:

{
  devices(role: "backbone"){
    id
    name
    device_role {
      name
      slug
    }
  }
}

With this result, matching your expected results:

{
  "data": {
    "devices": [
      {
        "id": "7b871f65-d4d5-4ab5-8fd5-211a8e093976",
        "name": "jcy-bb-01.infra.ntc.com",
        "device_role": {
          "name": "Backbone",
          "slug": "backbone"
        }
      },
      {
        "id": "bfcd2323-5b32-4388-af61-05a7ed1404f7",
        "name": "nyc-bb-01.infra.ntc.com",
        "device_role": {
          "name": "Backbone",
          "slug": "backbone"
        }
      }
    ]
  }
}

Can you please confirm?

from nautobot.

veprimk avatar veprimk commented on May 28, 2024

I can confirm the same.

If the filters are coming from here.
Upon further research based on your comment, it seems that this might be a known issue with MultipleChoice Filter where filtering is becoming a NOOP due to no choice being present (assuming incorrect filter choice == no filter). This is based on this documentation of the filter.

from nautobot.

carbonarok avatar carbonarok commented on May 28, 2024

Similar issue: https://stackoverflow.com/questions/60010190/how-to-stop-graphql-django-filters-to-return-all-objects-when-filter-string-is

from nautobot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.