GraphQL:如何根据行销人员填写的内容返回灵活,动态的数组?

时间:2019-02-21 14:42:57

标签: graphql

潜在的问题如下:

GraphQL希望您准确指定要返回的字段。假设我们有这样的产品:

productId
title
slug
selectedOptions.[someAttributeId].defaultValue
selectedOptions.[someAttributeId].name
selectedOptions.[someAttributeId].description
selectedOptions.[someOtherAttributeId].defaultValue
selectedOptions.[someOtherAttributeId].name
selectedOptions.[someOtherAttributeId].description
selectedOptions.[...etc].defaultValue
selectedOptions.[...etc].name
selectedOptions.[...etc].description
...etc

为了方便阅读,我删除了JSON语法。重点是:每种产品有多少个属性,哪些属性不同。

我可以告诉GraphQL仅返回字段“ selectedOptions”及其包含的所有内容吗?还是我需要一些复杂的解决方法来检索属性ID并将其用于查询?

0 个答案:

没有答案