Lint Policies for GraphQL Schema | Cosmo by WunderGraph - WunderGraph

Enforce GraphQL schema conventions on every check

Configurable rules run on every wgc subgraph check. Catch naming violations, missing descriptions, and undocumented deprecations before schemas are published.

The problem

Schema quality decays without enforcement

Naming inconsistencies, missing descriptions, and incomplete deprecation directives accumulate over time. Code review catches some — and misses the rest.

Naming conventions drift across teams

Without enforcement, camelCase fields appear next to snake_case ones, PascalCase type names mix with lowercase variants, and enum values use inconsistent casing. Manual code review catches some violations but misses others.

Types ship without documentation

Descriptions are optional in GraphQL. Without a policy requiring them, types and fields go undocumented. API consumers have no context for what fields mean or when to use them.

Deprecated fields lack context

Fields marked @deprecated without a reason or removal date leave consumers without the information they need to migrate. The deprecation becomes noise rather than useful guidance.

Our solution

Automated schema quality checks

Lint policies run automatically on every schema check. Configure rules per namespace, set severity levels, and get violation reports before any schema is published.

From configuration to enforcement

  1. Lint policies are configured per namespace in Cosmo Studio.
  2. When the linter is enabled, rules are evaluated during every wgc subgraph check operation.
  3. Rules are set with a severity level: error (the check fails) or warning (the violation is flagged without failing).
  4. The linter parses the schema and evaluates it against the configured rules.
  5. Violations are reported with clear messages identifying which rule was broken and where.
  6. Rules run before schemas are published, catching issues in development rather than production.

Consistent schemas. Every check. Every namespace.

Before & After

Before Cosmo With Cosmo
Inconsistent field naming caught in code review — or not at all FIELD_NAMES_SHOULD_BE_CAMEL_CASE fails the check automatically
Types published without descriptions ALL_TYPES_REQUIRE_DESCRIPTION blocks the check if descriptions are missing
Deprecated fields with no reason or date REQUIRE_DEPRECATION_REASON and REQUIRE_DEPRECATION_DATE enforce context
Style enforcement depends on who reviews the PR Rules run consistently on every wgc subgraph check

Available rule categories

How lint policies work in Cosmo

Configure

Enable lint policies in Cosmo Studio for the namespace. Select which rules to enable and set severity (error or warning) for each.

Check

Run wgc subgraph check. The linter evaluates the schema against the configured rules before the check completes.

Report

Violations appear in the check output with the rule name and location. Error-severity violations cause the check to fail.

Fix

Correct the violations in the schema and re-run the check. Passing checks confirm the schema meets the configured policies.

What lint policies enforce

Consistent naming

Rules enforce camelCase fields, PascalCase types, and UPPER_CASE enum values across all subgraphs, automatically.

Documentation requirements

ALL_TYPES_REQUIRE_DESCRIPTION ensures every type has a description before it is published.

Deprecation standards

REQUIRE_DEPRECATION_REASON and REQUIRE_DEPRECATION_DATE mandate context for every @deprecated directive.

Configurable severity

Set rules as errors to block publishing or as warnings to flag violations without failing the check.

Enforce schema quality on every check

Configure lint rules once per namespace. Every schema check enforces them automatically.