Skip to content

backport[v16]: Introduce "recommended" validation rules #4119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 21, 2024
Prev Previous commit
Next Next commit
comment
  • Loading branch information
enisdenjo committed Jun 19, 2024
commit c10935fa81e02e1d91487f209adaf49658884426
5 changes: 4 additions & 1 deletion src/validation/specifiedRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule';
import { KnownTypeNamesRule } from './rules/KnownTypeNamesRule';
// Spec Section: "Lone Anonymous Operation"
import { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule';
import { MaxIntrospectionDepthRule } from './rules/MaxIntrospectionDepthRule';
// SDL-specific validation rules
import { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule';
// Spec Section: "Fragments must not form cycles"
Expand Down Expand Up @@ -68,6 +67,9 @@ import { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule';
import { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule';
import type { SDLValidationRule, ValidationRule } from './ValidationContext';

// TODO: Spec Section
import { MaxIntrospectionDepthRule } from './rules/MaxIntrospectionDepthRule';

/**
* This set includes all validation rules defined by the GraphQL spec.
*
Expand Down Expand Up @@ -101,6 +103,7 @@ export const specifiedRules: ReadonlyArray<ValidationRule> = Object.freeze([
VariablesInAllowedPositionRule,
OverlappingFieldsCanBeMergedRule,
UniqueInputFieldNamesRule,
// Technically this isn't part of the spec but it's a strongly encouraged validation rule.
MaxIntrospectionDepthRule,
]);

Expand Down