Schedule icon
Request icon
If icon
SlackIncomingWebhook icon
Fail icon
Log icon

GraphQL deprecated field and schema evolution audit sentinel

Audit GraphQL schemas for deprecated fields and enum values via introspection, enforce sunsetting thresholds, and alert API teams on stale schema drift.

Categories
DataInfrastructure

Govern GraphQL schema evolution and monitor API sunsetting lifecycles by automatically auditing deprecated fields, arguments, and enum values. When evolving public or federated GraphQL APIs, backend teams tag outdated fields with @deprecated(reason: "...") to warn consumer applications before final removal. However, without automated auditing, deprecated fields frequently accumulate indefinitely, confusing client developers and inflating maintenance costs. This sentinel periodically queries your GraphQL schema introspection endpoint with includeDeprecated: true, tallies all deprecated members across all types, evaluates counts against tolerance thresholds, and publishes an actionable Slack digest complete with deprecation reasons.

How it works

  1. A Schedule trigger initiates the audit on a weekly cadence every Monday at 09:00 UTC (shipped disabled by default).
  2. Task query_schema_deprecations uses io.kestra.plugin.graphql.Request to query the GraphQL introspection system for __schema.types, explicitly requesting fields(includeDeprecated: true) and enumValues(includeDeprecated: true) alongside isDeprecated and deprecationReason.
  3. Task evaluate_deprecations (io.kestra.plugin.core.flow.If) counts all deprecated fields across types using jq filtering and compares the total against inputs.max_allowed_deprecated_fields:
    • If the threshold is exceeded: Task alert_deprecated_fields_digest sends a formatted Slack notification listing the total count and top deprecated fields with reasons. If inputs.fail_on_threshold_breach is true, task fail_deprecation_gate (io.kestra.plugin.core.execution.Fail) terminates the workflow with an error.
    • If within threshold: Task log_deprecations_healthy records healthy compliance.
  4. Task log_audit_summary outputs structured metrics including total deprecated counts.
  5. Top-level errors handler catches connection errors or unreachable endpoints.

What you get

  • Continuous visibility into deprecated fields across internal microservices, federated subgraphs, or public APIs.
  • Automated detection of forgotten deprecated fields to keep schema documentation clean and concise.
  • Detailed Slack digests displaying exact parent types, field names, and migration recommendations.
  • Configurable deployment gate to prevent merging changes that introduce excess technical debt.

Who it's for

  • API Platform and Core Infrastructure teams maintaining public or internal GraphQL services.
  • Backend Engineers tracking schema migration lifecycles and sunsetting schedules.
  • Developer Experience (DevEx) teams ensuring consistent client developer journeys.

Why orchestrate this with Kestra

Ad-hoc scripts running on developer laptops fail to provide continuous compliance history or centralized alerting. Kestra provides declarative, version-controlled workflows with native GraphQL querying, jq transformation pipelines, secrets management, and automated scheduling. Rather than building custom API scrapers, your schema governance runs as a production-grade, observable pipeline directly within your orchestrator.

Prerequisites

  • Network connectivity from the Kestra worker to the target GraphQL endpoint.
  • A valid authentication token or API key if the GraphQL endpoint requires credentials.

Secrets

  • GRAPHQL_AUTH_TOKEN: Bearer token or API key used in the Authorization header to access the schema.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used to post deprecation digests and error alerts.

Quick start

  1. Add your Slack incoming webhook URL and API token under Kestra Secrets (SLACK_WEBHOOK_URL and GRAPHQL_AUTH_TOKEN).
  2. Provide your GraphQL endpoint URL in graphql_endpoint_url (e.g. https://api.yourcompany.com/graphql).
  3. Trigger a manual execution from the Kestra UI to review currently deprecated fields.
  4. Enable the weekly_deprecation_audit trigger to receive recurring reports every Monday.

How to extend

  • Compare deprecation counts against previous execution outputs using Kestra KV store to track week-over-week migration velocity.
  • Parse sunset dates within deprecation reasons (e.g., "Deprecated as of 2026-12-01") and trigger high-priority alerts when sunset dates pass.
  • Generate Jira or Linear tickets automatically for deprecated fields that remain unremoved after 90 days.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.