Auto-Generate React Forms from a HotChocolate GraphQL Schema

Versions: @rjsf/core v6.6.2 is the current stable release. v5 was a major breaking change from v3/v4 - the validator prop became required and the validator was extracted into @rjsf/validator-ajv8. The code in this article targets v5+. @graphql-codegen/cli v5 is current and the config format shown is compatible. Internal tooling is where good architecture goes to die. Every backfill, every data-correction operation, every admin action ends up with the same choice: write a one-off form, use the GraphQL playground, or write a script. The first option takes hours and is immediately outdated. The second only works if you let engineers near production data. The third requires a developer every time. ...

September 1, 2022 · 6 min · Erwan Joly

HotChocolate: Sync Validation Rules to the Frontend via GraphQL Directives

This approach is based on Nigel Sampson’s post on GraphQL validation metadata, extended with a recursive validation middleware and a codegen pipeline for the frontend. Versions: HotChocolate v16.2.0 is the current stable release. The TypeInterceptor and DirectiveType APIs shown here have been stable since v12 and are unchanged through v16. v15+ dropped .NET 6/7 support - .NET 8 or later is required. The middleware syntax uses C# 12 primary constructors; see the note in that section if you are on an older SDK. ...

August 31, 2022 · 7 min · Erwan Joly