Guillotine: Fetching Data for parts with itemsets

I have a part for a image carousel with the following configuration:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<part xmlns="urn:enonic:xp:model:1.0">
    <display-name>Hero</display-name>
    <description>Hero mit Hintergrund-Bild</description>
    <form>
        <!--  anzuzeigende Elemente  -->
        <item-set name="elements">
            <label>anzuzeigende Elemente</label>
            <occurrences minimum="1" maximum="0"/>
            <items>
                <input name="header" type="TextLine">
                    <label>Überschrift</label>
                    <occurrences minimum="1" maximum="1"/>
                </input>
                <input name="teaser" type="TextLine">
                    <label>Text</label>
                    <default>Enter description here</default>
                </input>
                <input name="image" type="ImageSelector">
                    <label>Anzuzeigendes Bild</label>
                    <occurrences minimum="0" maximum="1"/>
                    <config>
                        <allowPath>${site}/images</allowPath>
                        <treeMode>true</treeMode>
                        <showStatus>true</showStatus>
                        <hideToggleIcon>false</hideToggleIcon>
                    </config>
                </input>
            </items>
        </item-set>
    </form>
</part>

When I fetch, using the following query, I also get other parts (here layout):

query ($path: String!) {
  guillotine {
    queryDsl(query: {                
          term:{
            field:"_path",            
            value: {              
              string: $path
            }            
          }                      
    }) {
      _id
      displayName
      type
      components {
        __typename        
        part {         
          config {
            de_osde_app_be {
              hero {
                elements {
                  header
                  teaser
                  image {
                    ... on media_Image {
                      imageUrl(type: absolute, scale: "width(1280)")
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Result:

{
  "data": {
    "guillotine": {
      "queryDsl": [
        {
          "_id": "6bc85db6-0298-416c-bd1f-fae1f919b1e8",
          "displayName": "Outsourcing Portal",
          "type": "portal:site",
          "components": [
            {
              "__typename": "Component",
              "part": null
            },
            {
              "__typename": "Component",
              "part": {
                "config": {
                  "de_osde_app_be": {
                    "hero": {
                      "elements": [
                        {
                          "header": "Outsourcing Portal",
                          "teaser": "Enter description here",
                          "image": {
                            "imageUrl": "http://localhost:8080/admin/site/preview/be/draft/_/image/dbf047d9-b5a5-49a0-b63f-296a62c9edb3:b16242430d443c56bcf3be653d98bbbfab454c5f/width-1280/AdobeStock_641644223.jpeg"
                          }
                        },
                        {
                          "header": "Outsourcing Portal 2",
                          "teaser": "Enter description here",
                          "image": {
                            "imageUrl": "http://localhost:8080/admin/site/preview/be/draft/_/image/045a4b50-09f8-46cf-86a2-3fd560c1dfa3:6795d3b2c19e0aaf6eb252d37d9049d9a8151dd5/width-1280/AdobeStock_640437641.jpeg"
                          }
                        }
                      ]
                    }
                  }
                }
              }
            },
            {
              "__typename": "Component",
              "part": null
            },
            {
              "__typename": "Component",
              "part": {
                "config": {
                  "de_osde_app_be": {
                    "hero": null
                  }
                }
              }
            }
          ]
        }
      ]
    }
  }
}

How do I get rid off the parts with null ???

Hi!
Guillotine does not support filtering by component type. A component is a complex object that includes all possible component types, such as part, layout, page, etc. If you need to obtain only parts, then you should filter out all non-nullable parts from the response in your code.

2 Likes

I almost thought so. Thanks for explaining and Merry Christmas !!

1 Like

Thank you! Merry Christmas and Happy New Year!