Skip to main content

libgraphql_parser/
reserved_name_context.rs

1/// Contexts where certain names are reserved in GraphQL.
2///
3/// Some names have special meaning in specific contexts and cannot be used
4/// as identifiers there. This enum is used by `GraphQLParseErrorKind::ReservedName`
5/// to indicate which context rejected the name.
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum ReservedNameContext {
8    /// Fragment names cannot be `on` (it introduces the type condition).
9    ///
10    /// Invalid: `fragment on on User { ... }`
11    /// The first `on` would be parsed as the fragment name, but `on` is
12    /// reserved in this context.
13    FragmentName,
14
15    /// Enum values cannot be `true`, `false`, or `null`.
16    ///
17    /// Invalid: `enum Bool { true false }` or `enum Maybe { null some }`
18    /// These would be ambiguous with boolean/null literals in value contexts.
19    EnumValue,
20}