[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
- Go to https://demo.pimcore.com/
- Open graphQl assets configuration and add Asset Listing read permission in the Schema Definition
- Add
/Sample Content/Dev Examples/Properties
to the Assets Workspaces and save configuration - Open playground or go to https://demo.pimcore.com/pimcore-datahub-webservices/explorer/assets?apikey=9e265983fbd2dc42b8f7cdb841c82807
- 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} } } } } }
- List of assets is returned with some empty nodes
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.
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