ChilliCream / ChilliCream/graphql-platform

Generated query response is empty

Open
#6,285 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ strawberry shake
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Is there an existing issue for this?
  • I have searched the existing issues
Product

Strawberry Shake

Describe the bug

Based on Demo project from docs I prepared project pointing to my endpoint and using my query. I'm using .NET 7.

I had to remove JSON scalar from schema because of other bug: https://github.com/ChilliCream/graphql-platform/issues/5899 to make it work.

Repository: https://github.com/kpiekara/crystallize-example/blob/main/Demo

Schema: https://github.com/kpiekara/crystallize-example/blob/main/Demo/schema.graphql

Query: https://github.com/kpiekara/crystallize-example/blob/main/Demo/GetItem.graphql
Most interesting part:

query GetItem ($language: String!, $path: String!) {
    catalogue(language: $language, path: $path) {
        ...on Product {
            ...product
            topics {
                path
                name
            }
        }
    }
}

fragment product on Product {
    id
    name
    type
    language
    path

    components {
        ...component
    }

    variants {
        name
        sku
        components {
            ...component
        }
        price
        priceVariants {
            identifier
            name
            price
            currency
        }
        stockLocations {
            identifier
            name
            stock
        }
        isDefault
        images {
            url
            altText
            key

            variants {
                key
                width
                url
            }
        }

        subscriptionPlans {
            identifier
            name
            periods {
                id
                name
                initial {
                    priceVariants {
                        identifier
                        name
                        price
                        currency
                    }
                }
                recurring {
                    priceVariants {
                        identifier
                        name
                        price
                        currency
                    }
                }
            }
        }
    }

    vatType {
        name
        percent
    }
}

Generated client:

[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "13.2.1.0")]
public partial interface IGetItemResult
{
    public global::Demo.IGetItem_Catalogue? Catalogue { get; }
}

[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "13.2.1.0")]
public partial interface IGetItem_Catalogue
{
}

[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "13.2.1.0")]
public partial interface IGetItem_Catalogue_Document : IGetItem_Catalogue
{
}

[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "13.2.1.0")]
public partial interface IGetItem_Catalogue_Folder : IGetItem_Catalogue
{
}

[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "13.2.1.0")]
public partial interface IGetItem_Catalogue_Product : IGetItem_Catalogue
{
    public global::System.Collections.Generic.IReadOnlyList<global::Demo.IGetItem_Catalogue_Topics>? Topics { get; }
}

For code:

var client = services.GetRequiredService<Icatalogue>();
var result = await client.GetItem.ExecuteAsync("", "");
result.EnsureNoErrors();
result.Data.Catalogue.

Catalogue has no properties.

var client = services.GetRequiredService<Icatalogue>();
var result = await client.GetItem.ExecuteAsync("", "");
result.EnsureNoErrors();
(result.Data.Catalogue as IGetItem_Catalogue_Product).

Catalogue has only 'Topics' property.

Steps to reproduce
  1. Clone repository
  2. Build
Relevant log output

No response

Additional Context?

No response

Version

13.2.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone and build the linked Demo repository, then inspect schema.graphql, GetItem.graphql, and the generated IGetItem result interfaces. Compare the selected Product fields with the generated Catalogue properties and investigate why only Topics is emitted. Done means the generated client exposes the requested Product selection and the reproduction query returns the expected data.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.