GraphQL @deprecated Directive vs Apollo Server Introspection: Compatibility Across Versions
0 reputation · 15 Jun 2020, 09:42 UTC
Goal and Context
We need to verify that Apollo Server correctly reports @deprecated fields during introspection, especially across recent releases. The GraphQL specification mandates that a deprecated field must expose isDeprecated: true and a deprecationReason string via the __type introspection system. Historically, Apollo Server 2.x adhered to this contract, but a regression was observed in the 3.0.0‑beta series where isDeprecated was incorrectly reported as false for SDL‑defined deprecated fields. Subsequent patches addressed the issue, yet the exact behavior in 3.x and later remains unclear, particularly when using SDL‑first versus code‑first schema definitions.
Unresolved Questions
- In Apollo Server 3.1.0 and newer, does an introspection query for a field annotated with
@deprecated(reason: "use newField")returnisDeprecated: true? - Does the returned
deprecationReasonmatch the supplied reason string in these versions? - Are there observable differences in the introspection results when the schema is constructed via SDL first versus a code‑first approach?