ChilliCream / ChilliCream/graphql-platform

Cannot reuse an '[Interface]' query object as an 'InputObject'

Open
#7,609 0 comments 0 reactions 1 assignee View on GitHub

@michaelstaib is already working on this.

Since Mar 17, 2025.

🌶️ hot chocolate Area: Type System
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Product

Hot Chocolate

Version

14.0

Link to minimal reproduction

https://github.com/onionhammer/repro-graphql-mutations

Steps to reproduce

Add an 'InterfaceType' for querying, ala:

image

Then add a query for it:

image

Add a mutation type to allow it to come in as an input (EnableOneOf in program.cs)

image

Add a mutation for it

image

What is expected?

The schema would generate query and mutation values using the same underlying DTOs

What is actually happening?

An exception, which only occurs if the query is present.

  1. There is no object type implementing interface `BaseThing`. (HotChocolate.Types.InterfaceType<Repro.GraphQLMutations.BaseThing>)

     at HotChocolate.SchemaBuilder.Setup.CompleteSchema(SchemaBuilder builder, IDescriptorContext context, LazySchema lazySchema, TypeRegistry typeRegistry)
     at HotChocolate.SchemaBuilder.Setup.Create(SchemaBuilder builder, LazySchema lazySchema, IDescriptorContext context)
     at HotChocolate.SchemaBuilder.Create(IDescriptorContext context)
     at HotChocolate.SchemaBuilder.HotChocolate.ISchemaBuilder.Create(IDescriptorContext context)
     at HotChocolate.Execution.RequestExecutorResolver.CreateSchemaAsync(ConfigurationContext context, RequestExecutorSetup setup, RequestExecutorOptions executorOptions, IServiceProvider schemaServices, TypeModuleChangeMonitor typeModuleChangeMonitor, CancellationToken cancellationToken)   
     at HotChocolate.Execution.RequestExecutorResolver.CreateSchemaServicesAsync(ConfigurationContext context, RequestExecutorSetup setup, CancellationToken cancellationToken)
     at HotChocolate.Execution.RequestExecutorResolver.GetRequestExecutorNoLockAsync(String schemaName, CancellationToken cancellationToken)
     at HotChocolate.Execution.RequestExecutorResolver.GetRequestExecutorAsync(String schemaName, CancellationToken cancellationToken)
     at HotChocolate.Execution.RequestExecutorProxy.GetRequestExecutorAsync(CancellationToken cancellationToken)
     at HotChocolate.AspNetCore.HttpPostMiddlewareBase.HandleRequestAsync(HttpContext context)
     at HotChocolate.AspNetCore.HttpPostMiddlewareBase.InvokeAsync(HttpContext context)
     at Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.<>c__DisplayClass23_0.<<UseCancellation>b__1>d.MoveNext()
  --- End of stack trace from previous location ---
     at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

If the query is commented out, the mutation works. If the mutation is commented out the query works.

image

If the query portion is changed to the following, the everything works again:
Image

Relevant log output

No response

Additional context

No response

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.