norm

package
v1.11.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: BSD-2-Clause Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package norm provides a reader that normalizes Unicode escape sequences in GraphQL string literals.

Summary of behavior and motivation:

  • Newly supported executable GraphQL documents include string literals using GraphQL-specific Unicode escapes, especially braced escapes (for example, \u{1F600}, \u{10FFFF}, \u{0}) and valid UTF-16 surrogate pairs (for example, \uD83D\uDE00).
  • Raw UTF-8 characters (for example, 😀) were already supported by text/scanner because it can decode UTF-8 source text.
  • The gap was escape grammar compatibility, not UTF-8 decoding: GraphQL escape forms are not a strict match for Go string escape handling in text/scanner.
  • This reader rewrites GraphQL escapes inside normal string literals into scanner-compatible forms while leaving block strings, comments, and non-string source text unchanged.

Example query form enabled by normalization:

mutation {
  createReview(episode: JEDI, review: { stars: 5, commentary: "Loved it \u{1F600}" }) {
    commentary
  }
}

Required as of Sep 2025 GraphQL spec: https://github.com/graphql/graphql-spec/pull/849.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReader

func NewReader(src string) io.Reader

NewReader returns an io.Reader for src. For sources without any \u escapes it returns strings.Reader directly. Otherwise it returns a normalizing reader that rewrites GraphQL Unicode escapes.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL