Generated query response is empty
See original GitHub issueIs 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
- Clone repository
- Build
Relevant log output
No response
Additional Context?
No response
Version
13.2.1
Issue Analytics
- State:
- Created 3 months ago
- Comments:5
Top Results From Across the Web
Simple check for SELECT query empty result - sql
Can anyone point out how to check if a select query returns non empty result set? For example I have next query: SELECT...
Read more >Is it possible to return empty response if there is no records ...
Is it possible to return empty objects if there is no records in db? db.query(' SELECT * from users where type = $1...
Read more >SQL-Query is always empty
It works most of the time, until the generated name is different from the one expected.
Read more >How to return Null or value when nothing is ...
I have a simple query: SELECT name FROM atable WHERE a = 1. I want it to return Null if it finds nothing,...
Read more >Why do I get zero records when I query my Amazon Athena ...
There are several common reasons why the query might return zero records. Based on your use case, see the related section for common...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah. I misunderstood the issue
One way to resolve this is to replace this
with
I checked and can confirm it works! As I understand this is workaround? Should I close issue since it is resolved for me?
What would happen if I will have a query in future, which will be able to return two types there? This solution will not work?