-
-
Notifications
You must be signed in to change notification settings - Fork 794
Open
Labels
Description
Product
Strawberry Shake
Version
15.1.10
Link to minimal reproduction
https://github.com/denys-vynohradov-saltykov/strawberryshake-server-nested-list-error-poc
Steps to reproduce
- Create class library project
- Install StrawberryShake.Server as in the instruction https://chillicream.com/docs/strawberryshake/v13/get-started/console
- schema.graphql:
schema {
query: Query
}
type Query {
coordinates: [[[Float!]!]!]!
}
- GetCoordinates.graphql:
query GetCoordinates {
coordinates
}
- Build solution
What is expected?
- Solution is build without errors
- GraphqlApiClient.cs is generated in the
obj\Debug\net9.0\berry
directory
What is actually happening?
Exception is thrown on build
Relevant log output
dotnet "<path to the tool>\dotnet-graphql.dll" generate "<path to the project>\obj\Debug\net9.0\berry" -n StrawberryShakeServer.NestedList.PoC -a md5 -t
Generate C# Clients started.
Generate GraphqlApiClient started.
Generate GraphqlApiClient completed in 171 ms
Generate C# Clients completed in 256 ms
Unhandled exception. System.AggregateException: One or more errors occurred. (The type structure is invalid.)
---> System.ArgumentException: The type structure is invalid.
at HotChocolate.Types.TypeExtensions.NamedType(IType type) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs:line 535
at HotChocolate.Types.TypeExtensions.EnsureOutputType(IType type) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs:line 292
at HotChocolate.Types.OutputFieldBase.OnCompleteField(ITypeCompletionContext context, ITypeSystemMember declaringMember, OutputFieldDefinitionBase definition) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Types/OutputFieldBase.cs:line 63
at HotChocolate.Types.OutputFieldBase.OnCompleteField(ITypeCompletionContext context, ITypeSystemMember declaringMember, FieldDefinitionBase definition) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Types/OutputFieldBase.cs:line 54
at HotChocolate.Types.FieldBase.CompleteField(ITypeCompletionContext context, ITypeSystemMember declaringMember) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Types/FieldBase.cs:line 70
at HotChocolate.Types.FieldBase.HotChocolate.Types.Helpers.IFieldCompletion.CompleteField(ITypeCompletionContext context, ITypeSystemMember declaringMember) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Types/FieldBase.cs:line 89
at HotChocolate.Internal.FieldInitHelper.CompleteFieldsInternal[TField](ITypeCompletionContext context, ITypeSystemMember declaringMember, TField[] fields) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Internal/FieldInitHelper.cs:line 202
at HotChocolate.Internal.FieldInitHelper.CompleteFieldsInternal[TFieldDefinition,TField](ITypeCompletionContext context, ITypeSystemMember declaringMember, IEnumerable`1 fieldDefinitions, Func`3 fieldFactory, Int32 fieldCount) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Internal/FieldInitHelper.cs:line 185
at HotChocolate.Internal.FieldInitHelper.CompleteFields[TFieldDefinition,TField](ITypeCompletionContext context, ITypeSystemMember declaringMember, IReadOnlyList`1 fieldDefs, Func`3 fieldFactory) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Internal/FieldInitHelper.cs:line 58
at HotChocolate.Types.ObjectType.OnCompleteFields(ITypeCompletionContext context, ObjectTypeDefinition definition) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs:line 164
at HotChocolate.Types.ObjectType.OnCompleteType(ITypeCompletionContext context, ObjectTypeDefinition definition) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs:line 69
at HotChocolate.Types.TypeSystemObjectBase`1.CompleteType(ITypeCompletionContext context) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs:line 114
at HotChocolate.Configuration.TypeInitializer.CompleteType(RegisteredType registeredType) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs:line 605
at HotChocolate.Configuration.TypeInitializer.<CompleteTypes>b__33_0(RegisteredType type) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs:line 586
at HotChocolate.Configuration.TypeInitializer.ProcessTypes(TypeDependencyFulfilled fulfilled, Func`2 action) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs:line 675
at HotChocolate.Configuration.TypeInitializer.CompleteTypes() in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs:line 586
at HotChocolate.Configuration.TypeInitializer.Initialize() in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs:line 107
at HotChocolate.SchemaBuilder.Setup.InitializeTypes(SchemaBuilder builder, IDescriptorContext context, IReadOnlyList`1 types) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs:line 219
at HotChocolate.SchemaBuilder.Setup.Create(SchemaBuilder builder, LazySchema lazySchema, IDescriptorContext context) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs:line 78
at HotChocolate.SchemaBuilder.Setup.Create(SchemaBuilder builder) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs:line 29
at HotChocolate.SchemaBuilder.Create() in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/SchemaBuilder.Create.cs:line 9
at HotChocolate.SchemaBuilder.HotChocolate.ISchemaBuilder.Create() in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Core/src/Types/SchemaBuilder.Create.cs:line 28
at StrawberryShake.CodeGeneration.Utilities.SchemaHelper.Load(IReadOnlyCollection`1 schemaFiles, Boolean strictValidation, Boolean noStore) in /home/runner/work/graphql-platform/graphql-platform/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/SchemaHelper.cs:line 89
at StrawberryShake.CodeGeneration.CSharp.CSharpGenerator.TryCreateSchema(IReadOnlyList`1 files, Dictionary`2 fileLookup, ICollection`1 errors, Boolean strictValidation, Boolean noStore, ISchema& schema) in /home/runner/work/graphql-platform/graphql-platform/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/CSharpGenerator.cs:line 422
at StrawberryShake.CodeGeneration.CSharp.CSharpGenerator.GenerateAsync(IEnumerable`1 fileNames, CSharpGeneratorSettings settings) in /home/runner/work/graphql-platform/graphql-platform/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/CSharpGenerator.cs:line 97
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at StrawberryShake.Tools.GenerateCommand.GenerateCommandHandler.GenerateClient(String clientName, String[] documents, CSharpGeneratorSettings settings) in /home/runner/work/graphql-platform/graphql-platform/src/StrawberryShake/Tooling/src/dotnet-graphql/GenerateCommand.cs:line 164
at StrawberryShake.Tools.GenerateCommand.GenerateCommandHandler.ExecuteAsync(GenerateCommandArguments args, CancellationToken cancellationToken) in /home/runner/work/graphql-platform/graphql-platform/src/StrawberryShake/Tooling/src/dotnet-graphql/GenerateCommand.cs:line 124
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
at StrawberryShake.Tools.Program.<Main>(String[] args)
0>StrawberryShake.Server.targets(71,5): Error MSB3073 : The command "dotnet "<path to the tool>\dotnet-graphql.dll" generate "<path to the project>" -o "<path to the project>\obj\Debug\net9.0\berry" -n StrawberryShakeServer.NestedList.PoC -a md5 -t" exited with code -532462766.
0>------- Finished building project: <project name>. Succeeded: False. Errors: 1. Warnings: 0
Build completed in 00:00:03.232
Additional context
Possibly related to similar issue with HotChocolate
#8723
Why do we need triple-nested arrays in the schema:
- to introduce subset of GeoJSON standard into the schema. GeoJSON Polygon coordinates is an array of array of array.
https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6 - HotChocolate.Data.Spatial is overkill since we do not need most of the types provided in the package
Known workaround is to introduce custom scalar that represents float array
"""
Array of floating point numbers
For example: [3.14, 2.7]
"""
scalar Position
type Query {
coordinates: [[Position!]!]!
}
ruslan-monar, zelenskiyMykhailo, PotiraiRostyslav, dmitryspain, mac2000 and 2 more