Conversation
Fix @example blocks whose `// =>` results don't match what the code actually returns, and property descriptions that were copied from unrelated APIs.
|
@Cito is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel. A member of the Team first needs to authorize it. |
Cito
marked this pull request as ready for review
September 27, 2026 15:25
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While porting the new API docs to GraphQL-core (the Python port), every
@examplewas run as a doctest. That turned up a few examples that don't produce what their// =>comments say, and some descriptions that were copied from a different API. This PR fixes them.Examples
validation/validate.ts: the schema definedfullName, but the example validated{ greeting }and expected no errors; the schema now definesgreeting.type/definition.ts(GraphQLEnumType.valueToLiteral): the example passed the internal value2, but the method takes the external value name, so it returnedundefinedandprint()threw; nowvalueToLiteral('BLUE'). The summary and@paramsaid "runtime enum value" and now say "external enum value name".type/directives.ts(GraphQLDirective):extend directive @cacheControl(maxAge: Int) on FIELD_DEFINITIONis a syntax error because directive extensions can only add directives; nowextend directive @cacheControl @tag.utilities/findSchemaChanges.ts: the result order was reversed; the function returns['FIELD_ADDED', 'OPTIONAL_ARG_ADDED'].utilities/coerceInputValue.ts,execution/values.ts(coerceInputValue,coerceInputLiteral,getVariableValues,getArgumentValues): the examples passed'5'/'4'forIntinputs, which yieldsundefinedor coercion errors instead of the documented values; they now pass numbers.utilities/TypeInfo.ts(leave): after leaving the field,getType()returns the parent typeQuery, notundefined; the@paramalso said "being entered".utilities/buildASTSchema.ts(buildSchema):@tagwas applied to a directive definition but declaredon FIELD_DEFINITION, so schema validation failed; it is now declaredon DIRECTIVE_DEFINITION.validation/rules/custom/NoSchemaIntrospectionCustomRule.ts:{ __schema { queryType { name } } }reports 2 errors (__schemaandqueryType), not 1.Descriptions
validation/rules/DeferStreamDirectiveOnValidOperationsRule.ts: the summary was copied fromDeferStreamDirectiveOnRootFieldRule; the rule actually forbids@defer/@streamin subscription operations unless they can be disabled or skipped.language/ast.ts(FragmentArgumentNode): described as a variable definition with a default value, but it is an argument supplied on a fragment spread (...Frag(arg: value)).type/definition.ts(GraphQLResolveInfo):fieldName,pathandschemahad descriptions from other APIs ("referenced by this schema coordinate", "where this error occurred", "used for validation or execution").utilities/getIntrospectionQuery.ts(IntrospectionSchema.types) andtype/schema.ts(GraphQLSchemaConfig.types): both said "Object types that belong to this union type".Every changed example was executed against this branch, and each
// =>comment now matches the actual result. Before this change, 11 of those example blocks failed or threw.The fixes in
directives.ts,coerceInputValue.ts,values.ts,TypeInfo.ts,buildASTSchema.ts,NoSchemaIntrospectionCustomRule.ts,GraphQLResolveInfo,getIntrospectionQuery.tsandschema.tsalso apply to the same text on16.x.xand could be backported.It might be worth running the
@exampleblocks in CI to catch such drift automatically. At the momentprettier:examples:checkonly formats them.