Fairybread Versions Save

Input validation for HotChocolate

v8.0.0-rc.5

2 years ago

v7.2.0-rc.1

2 years ago

v7.1.1

2 years ago

v8.0.0-rc.4

2 years ago

v8.0.0-rc.3

2 years ago

v8.0.0-rc.2

2 years ago

v7.1.0

2 years ago

Note: currently unlisted while issue reported on runtime type discovery is solved

Extends improvements made in v7.0.0 (read those release notes first).

FairyBread will now avoid adding its field middleware on fields when the arg/s don't actually have any applicable validators (after figuring out the arg's runtime type).

You can turn this feature off via options if needed, but the recommendation is it should be left on unless you encounter some issues in the argument crawling.

Breaking changes

  1. I made a change to the IFairyBreadOptions interface (two new properties), but I highly doubt anyone is relying on it directly so I chose to accept a breaking change in a feature release as v8 has already been reserved for a HCv12 compatible release. I imagine this won't affect anyone.

v8.0.0-rc.1

2 years ago

v8.0.0-preview.1

2 years ago

v7.0.0

2 years ago

This release changes the way the validation field middleware is added.

It is now registered only on fields that have args (rather than on every field in your schema regardless of whether it even had a validator). Runtime-determination of whether an arg should be validated is gone (but if people were using it we can add it back again). It's effectively been "replaced" by schema-build-time determination, using a similar option that'll be executed by a type interceptor and attach the middleware only where needed. This vastly simplies FairyBread and will improve perf.

API changes:

  • IFairyBreadOptions.ShouldValidate is now gone. Use ShouldValidateArgument. If you need runtime support, let me know and we can re-add it.
  • IFairyBreadOptions.SetNullResultOnValidationError is removed. Before, the default was true, and now FairyBread won't set the Result at all. See #46. If you still need the control back though, let me know and we can re-add this option.
  • IArgumentDescriptor.UseValidation, IInputObjectTypeDescriptor.UseValidation and ValidateAttribtue are gone for similar reasons. Every query field's arg is now validated by default.

Default behaviour changes:

  • Due to schema-build-time determination of where validation is needed, it isn't really necessary to disable by default validation in Query types which was mostly for perf reasons. So now arguments are validated by default anywhere in the schema, including inside Query type, wherever there's an appropriate validator.

Next

  • v7.1 will take this even further and only add the validation middleware when there's actually validators set up for the arg/s of a particular field.
  • v7.2 will introduce ability to explicitly set validation on args as/when needed to override implicitness.