pimcore/data-hub

[Bug]: GraphQl - query for listing asset meta data returns empty nodes and null meta data values

lukmzig opened this issue · 2 comments

Expected behavior

List of asset meta data is returned without empty nodes
List of asset meta data is returned with null metadata only if there is none defined

Actual behavior

  • List of asset meta data is returned with empty nodes
  • Metadata are returned as null, even though in the asset you can see the fields with empty values (maybe just the UI issue for the asset?)

Steps to reproduce

  1. Go to https://demo.pimcore.com/
  2. Open graphQl assets configuration and add Asset Listing read permission in the Schema Definition
  3. Add /Sample Content/Dev Examples/Properties to the Assets Workspaces and save configuration
  4. Open playground or go to https://demo.pimcore.com/pimcore-datahub-webservices/explorer/assets?apikey=9e265983fbd2dc42b8f7cdb841c82807
  5. Add Query to list asset meta data with data e.g
    { getAssetListing { totalCount edges { node { ... on asset { id fullpath metadata(ignore_language: true) { name type data} } } } } }
  6. List of assets is returned with some empty nodes

@lukmzig

List of asset meta data is returned with empty nodes

The empty node is the asset folder returned in the response. You need to either use inline fragment ... on asset_folder to fetch asset folder properties or use the filter on the query to list only assets.

Metadata are returned as null, even though in the asset you can see the fields with empty values (maybe just the UI issue for the asset?)

This is intended behavior in admin-ui that default metadata fields are displayed, when there is no metadata saved for an asset. The returned null value in the Response is correct, since there are no metadata stored in the DB for this asset.

@lukmzig

List of asset meta data is returned with empty nodes

The empty node is the asset folder returned in the response. You need to either use inline fragment ... on asset_folder to fetch asset folder properties or use the filter on the query to list only assets.

Metadata are returned as null, even though in the asset you can see the fields with empty values (maybe just the UI issue for the asset?)

This is intended behavior in admin-ui that default metadata fields are displayed, when there is no metadata saved for an asset. The returned null value in the Response is correct, since there are no metadata stored in the DB for this asset.

HI @robertSt7, thanks for the clarification! We should then probably adapt our query