Skip to content

v0.11.0

Choose a tag to compare

@github-actions github-actions released this 30 Nov 20:58
· 84 commits to master since this release
ebe9bb8

Serialization modes. A new SchemaConfig.Serialization option controls how values are serialized to the built-in scalars (Int, Float, String, Boolean, ID) and to enums (#7):

  • Lenient (default): unchanged. Values that cannot be serialized still become null or are converted as well as possible, silently: "12.50" for an Int becomes 12, a valid sql.NullInt64 becomes null.
  • Strict: serializes as the GraphQL specification and graphql-js do. Values are unwrapped first (driver.Valuer; for String and ID, encoding.TextMarshaler and fmt.Stringer). A value with a valid serialization returns it, and a value without one becomes a field error, such as Int cannot represent non-integer value: "12.50".
  • Report: returns exactly the lenient result and calls OnInvalidValue wherever strict mode would respond differently, with a Kind: invalid (strict returns a field error) or corrected (strict returns another value, in StrictResult).

Enabling strict mode can change responses that are accepted today: dates become RFC 3339, and values that come out as null or wrong in lenient mode return their value. Run report mode first, review the corrected and invalid events, and only then switch to strict. See the README.

What's Changed

Features

  • feat: report or reject values that cannot be serialized by @seriallink in #83

Bug fixes

Documentation

Maintenance

New Contributors

Full Changelog: v0.10.0...v0.11.0