4 releases

0.1.3 Feb 6, 2024
0.1.2 Nov 15, 2023
0.1.1 Nov 15, 2023
0.1.0 Oct 31, 2023

#26 in #graphql-schema

Download history 86/week @ 2025-11-18 103/week @ 2025-11-25 354/week @ 2025-12-02 311/week @ 2025-12-09 2/week @ 2025-12-16 32/week @ 2025-12-30 451/week @ 2026-01-06 605/week @ 2026-01-13 240/week @ 2026-01-20 452/week @ 2026-01-27 473/week @ 2026-02-03 203/week @ 2026-02-10 56/week @ 2026-02-17

330 downloads per month

Apache-2.0

53KB
1K SLoC

graphql-schema-validation

crates.io docs.rs

This crate implements GraphQL SDL schema validation according to the 2021 version of the GraphQL spec.

Scope:

  • All the spec and nothing but the spec.
  • Query documents are out of scope, we only validate schemas.
  • The error messages should be as close as possible to the style of other GraphQL schema validation libraries.

Example

use graphql_schema_validation::validate;

fn main() {
  let graphql = "schema { query: MyQueryDoesNotExist }";

  let diagnostics = validate(graphql);

  assert!(diagnostics.has_errors());

  let formatted_diagnostics = diagnostics.iter().map(|err| format!("{}", err)).collect::<Vec<String>>();
  assert_eq!(formatted_diagnostics, ["Cannot set schema query root to unknown type `MyQueryDoesNotExist`"]);
}

Status

The crate is being actively developed and maintained. It covers the spec completely and faithfully, as far as we are aware.

Dependencies

~6MB
~109K SLoC