You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a custom/user-defined payload type, a @cost weight is emitted. This differs from a non-custom payload type, where no @cost weight is emitted.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddGraphQLServer().AddQueryType<Query>().AddMutationType<Mutation>().AddMutationConventions();
var app = builder.Build();
app.MapGraphQL();
app.Run();
public record MyThing(string Id);
public class Query
{
public string Test => "";
}
public class Mutation
{
[Error<InvalidOperationException>] // Works (no custom payload type)
public MyThing CreateMyThing() => new("Foo");
[Error<InvalidOperationException>] // fails (custom payload type)
public DoSomethingPayload DoSomething() => new DoSomethingPayload(true);
}
public record DoSomethingPayload(bool Foo);
What is expected?
Schema should look like:
type CreateMyThingPayload {
myThing: MyThing
errors: [CreateMyThingError!]
}
type DoSomethingPayload {
foo: Boolean
errors: [DoSomethingError!]
}
What is actually happening?
Schema looks like:
type CreateMyThingPayload {
myThing: MyThing
errors: [CreateMyThingError!]
}
type DoSomethingPayload {
foo: Boolean
errors: [DoSomethingError!] @cost(weight: "10")
}
Relevant log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
N-Olbert
changed the title
Incorrect @cost weight for errors field in mutation conventions custom payloads
Incorrect @cost weight for errors field in mutation conventions for custom payloads
Oct 30, 2024
Product
Hot Chocolate
Version
14.0.0
Link to minimal reproduction
See code sample in issue
Steps to reproduce
When using a custom/user-defined payload type, a
@cost
weight is emitted. This differs from a non-custom payload type, where no@cost
weight is emitted.Basically, this is a follow-up to #7400
Sample:
What is expected?
Schema should look like:
What is actually happening?
Schema looks like:
Relevant log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: