-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
The validateName function that is used to validate lots of schema parts is currently only checking that names are not reserved:
graphql-js/src/type/validate.ts
Lines 206 to 217 in 6b253e7
| function validateName( | |
| context: SchemaValidationContext, | |
| node: { readonly name: string; readonly astNode: Maybe<ASTNode> }, | |
| ): void { | |
| // Ensure names are valid, however introspection types opt out. | |
| if (node.name.startsWith('__')) { | |
| context.reportError( | |
| `Name "${node.name}" must not begin with "__", which is reserved by GraphQL introspection.`, | |
| node.astNode, | |
| ); | |
| } | |
| } |
It should also check that the
name complies with https://spec.graphql.org/October2021/#Name, e.g. by testing against the regex /^(?!__)[A-Za-z_][A-Za-z0-9_]*$/.Metadata
Metadata
Assignees
Labels
No labels