pimcore / data-hub

Data delivery & consumption platform for Pimcore.
Other
127 stars 108 forks source link

Better support for object bricks #284

Open markuskaiser96 opened 4 years ago

markuskaiser96 commented 4 years ago

Hi there,

I am currently trying to define Schemas for a rather complex article class structure. What makes it complex is, that two fields (“articleGroup” and “dimensionGroup”) should be object bricks where “articleGroup” can be one of 4 different bricks, and “dimensionGroup” can be one of 11 different bricks. Each of those bricks has another 1 to 15 fields. Additionally, some of the fields inside the bricks have identical names - general fields like an ID or a description.

When plugging together the article schema I noticed, that I can only add all those fields of the bricks separately. There is no way to just drag the whole object brick into the schema, nor is there a way to group them under some parent node or so. This would result in a very large documentation when viewing this schema in GraphiQL Explorer and a lot of field names would occur multiple times.

I thought about wrapping some of the fields with an “Alias” and go for an “ObjectBrick-fieldName” naming convention or so. But still, the article would have a very long list of possible properties that are not clearly structured.

Is there a best practice for working with object bricks in GraphQL schemas already? Is better support for object bricks planned for the near future? Does anyone have an idea of how to work around this problem?

Thanks in advance, Markus

fhulleman commented 3 years ago

Hi @markuskaiser96, I'm having the exact same challenges, and I also solved it with aliases. But I'm also hoping for a better solution. Did you already have a better solution running? Or did you get response on this question? Thanks. Cheers, Frederik

longwave commented 3 years ago

It feels like it would be cleaner if object bricks were available as inline fragments with the ... on syntax in GraphQL.