Skip to content

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

@onionhammer

Description

@onionhammer

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

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions