Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ChilliCream/graphql-platform
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 12.4.0
Choose a base ref
...
head repository: ChilliCream/graphql-platform
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 12.4.1
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Dec 14, 2021

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Mic92 Jörg Thalheim
    Copy the full SHA
    014b2e2 View commit details

Commits on Dec 15, 2021

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Mic92 Jörg Thalheim
    Copy the full SHA
    20ed41f View commit details
5 changes: 1 addition & 4 deletions src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs
Original file line number Diff line number Diff line change
@@ -366,10 +366,7 @@ private static Schema CompleteSchema(
.Build());
}

Schema schema = typeRegistry.Types
.Select(t => t.Type).OfType<Schema>().First();
Console.WriteLine("Types: " + typeRegistry.Types.Count);

Schema schema = typeRegistry.Types.Select(t => t.Type).OfType<Schema>().First();
schema.CompleteSchema(definition);
lazySchema.Schema = schema;
context.SchemaInterceptor.OnAfterCreate(context, schema);
Original file line number Diff line number Diff line change
@@ -257,6 +257,8 @@ services
})
```

> Note: You can also partially opt-out of the convention by for instance crafting your own input type but letting the convention produce the payload.
## Errors

The second part of this new mutation convention involves user errors. We did a lot of work investigating how we should enable errors or even what pattern we should follow.
13 changes: 11 additions & 2 deletions website/src/docs/hotchocolate/defining-a-schema/mutations.md
Original file line number Diff line number Diff line change
@@ -223,7 +223,7 @@ type UpdateUserNamePayload {

Following this pattern helps to keep the schema evolvable but requires a lot of boilerplate code to realize.

## Introduction
## Input and Payload

HotChocolate has built-in conventions for mutations to minimize boilerplate code.

@@ -349,7 +349,7 @@ type Mutation {
</ExampleTabs.Schema>
</ExampleTabs>

## Defining Errors
## Errors

The mutation conventions also allow you to create mutations that follow the error
[stage 6a Pattern Marc-Andre Giroux layed out](https://xuorig.medium.com/a-guide-to-graphql-errors-bb9ba9f15f85) with minimal effort.
@@ -958,6 +958,15 @@ public UpdateUserNamePayload UpdateUserNameAsync(UpdateUserNameInput input)
}
```

You can also partially opt-out:

```csharp
public User UpdateUserNameAsync(UpdateUserNameInput input)
{
//...
}
```

### Custom error interface

Lastly, we can customize the error interface we want to use with our mutation convention. The error interface is shared across all error types that the schema defines and provides the minimum shape that all errors have to fulfill.