ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.26k stars 745 forks source link

Unable to resolve type reference `[Position]`. (HotChocolate.Types.InputObjectType) with spatial data using fusion gateway #6336

Open FairyFox5700 opened 1 year ago

FairyFox5700 commented 1 year ago

Is there an existing issue for this?

Product

Hot Chocolate

Describe the bug

I am trying to use spatial types in gateway layer, but receiving the error described below

My schema, the other types are from demo and have not been changed by me.

[Table("Users")]
public class Author
{
    [Key]
    public int Id { get; set; }

    [Required]
    [MaxLength(128)]
    public string? Name { get; set; }

    public Point Point { get; set; }

    public Polygon? Polygon { get; set; }

    public IList<Review> Reviews { get; set; } = new List<Review>();
}

I also had the same using stitching version 13.0.0 Is there any solution for this?

Steps to reproduce

    1. Start with project https://github.com/ChilliCream/hotchocolate-examples/tree/master/misc/Fusion1
  1. Add spatial types for the objects like this

    public Point Point { get; set; }
    
    public Polygon? Polygon { get; set; }

    Add spatial types to graph ql server .AddSpatialTypes()

  2. Generate schema: dotnet run --project Subgraphs/Reviews -- schema export --output schema.graphql
  3. Fusion pack: dotnet fusion subgraph pack -w ./Subgraphs/Reviews
  4. Fusion compose: dotnet fusion compose -p ./Gateway/gateway -s ./Subgraphs/Reviews

Note: I also used the SQL Server db connection Dependencies:

      <PackageReference Include="HotChocolate.Data.Spatial" Version="13.3.3" />
      <PackageReference Include="HotChocolate.Types.Spatial" Version="13.3.3" />
      <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
      <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="7.0.9" />
      <PackageReference Include="NetTopologySuite" Version="2.5.0" />
      <PackageReference Include="HotChocolate.AspNetCore" Version="13.3.3" />
          <PackageReference Include="HotChocolate.AspNetCore.CommandLine" Version="13.3.3" />
          <PackageReference Include="HotChocolate.Data.EntityFramework" Version="13.3.3" />
         <PackageReference Include="HotChocolate.Types.Analyzers" Version="13.3.3">

Relevant log output

HotChocolate.SchemaException: For more details look at the `Errors` property.

1. Unable to resolve type reference `[Position]`. (HotChocolate.Types.InputObjectType)

   at HotChocolate.Configuration.RegisteredType.GetType[T](TypeReference typeRef)
   at HotChocolate.Types.InputField.OnCompleteField(ITypeCompletionContext context, ITypeSystemMember declaringMember, InputFieldDefinition definition)
   at HotChocolate.Types.FieldBase`1.CompleteField(ITypeCompletionContext context, ITypeSystemMember declaringMember)
   at HotChocolate.Types.FieldBase`1.HotChocolate.Types.Helpers.IFieldCompletion.CompleteField(ITypeCompletionContext context, ITypeSystemMember declaringMember)
   at HotChocolate.Internal.FieldInitHelper.CompleteFieldsInternal[TField](ITypeCompletionContext context, ITypeSystemMember declaringMember, TField[] fields)
   at HotChocolate.Internal.FieldInitHelper.CompleteFieldsInternal[TFieldDefinition,TField](ITypeCompletionContext context, ITypeSystemMember declaringMember, IEnumerable`1 fieldDefinitions, Func`3 fieldFactory, Int32 fieldCount)
   at HotChocolate.Internal.FieldInitHelper.CompleteFields[TFieldDefinition,TField](ITypeCompletionContext context, ITypeSystemMember declaringMember, IReadOnlyList`1 fieldDefs, Func`3 fieldFactory)
   at HotChocolate.Types.InputObjectType.OnCompleteFields(ITypeCompletionContext context, InputObjectTypeDefinition definition)
   at HotChocolate.Types.InputObjectType.OnCompleteType(ITypeCompletionContext context, InputObjectTypeDefinition definition)

Additional Context?

No response

Version

13.3.3

MatthewMucker commented 6 months ago

I'm seeing a similar error in my project. Michael, you've marked this as a 'bug' so hopefully you understand the root cause... what can I look for in my project to see if my issue is the same thing?

michaelstaib commented 6 months ago

I have not marked it as a bug ... I just set the fusion tag ... we gonna look into it.