Expand description
This crate implements all diagnostics that Litho (a GraphQL framework) can emit.
Within Litho, these diagnostics are emitted by the lexer, parser, type checker and compiler. Typically, each of those can emit multiple diagnostics without bailing out after the first diagnostic, but the compiler will only advance to the next phase if there are no errors in the previous phase.
All diagnostics are generated by a DSL Macro (see source code), implement
DiagnosticInfo<S> and are generic with respect to the span that
triggered the diagnostic. Diagnostics consist of an error code, name,
message and zero or more labels. Labels are additional hints that refer to a
separate span in the source code.
§Example
Below is an example of a diagnostic that Litho generates:
MissingArgumentsClosingParentheses. It starts with the
code in square brackets, followed by a
message. It shows a snippet of the lines that
caused the diagnostic along with the primary span that starts at
graphql:6:20. And finally, it also shows two more spans
(first and
second) with additional
hints.
[E0006] Error: Arguments are missing closing parenthesis.
╭─[graphql:6:20]
│
6 │ field(arg: true
· ┬ ┬
· ╰──────────── This `(` here ...
· │
· ╰── ... should have a matching `)` here.
───╯Structs§
- Cyclic
Fragment Definition - (E0317) Fragment definition must not be cyclic.
- Different
Extension Type - (E0127) Type extension must extend type of same kind.
- Different
Field Arguments - (E0306) Selection set contains fields with the same name but different arguments.
- Different
Field Names - (E0305) Selection set contains different fields with the same name.
- Directive
InInvalid Location - (E0320) Directive must be used in valid location.
- Duplicate
Argument - (E0311) Argument may be provided only once.
- Duplicate
Argument Name - (E0106) Argument name must be unique.
- Duplicate
Directive Name - (E0126) Directive name must be unique.
- Duplicate
Enum Value - (E0122) Enum values must be unique.
- Duplicate
Extended Field - (E0103) Field name must be unique across extended types.
- Duplicate
Field - (E0102) Field name must be unique.
- Duplicate
Fragment Name - (E0313) Fragment definitions must be unique.
- Duplicate
Implements Interface - (E0109) Type must not implement same interface twice.
- Duplicate
NonRepeatable Directive - (E0321) Non-repeatable directive must be unique per location.
- Duplicate
Operation Name - (E0300) Operation definitions must be unique.
- Duplicate
Type Name - (E0126) Type name must be unique.
- Duplicate
Union Member - (E0119) Union members must be unique.
- Duplicate
Variable - (E0322) Variables must be unique per operation definition.
- Empty
Type - (E0101) Type must define one or more fields.
- Expected
Boolean Value - (E0205) Expected a boolean value.
- Expected
Enum Value - (E0210) Expected an enum value.
- Expected
Float Value - (E0203) Expected a float value.
- Expected
Input Object Value - (E0206) Expected an input object value.
- Expected
IntValue - (E0202) Expected an int value.
- Expected
List Value - (E0201) Expected a list value.
- Expected
NonNull Value - (E0200) Expected a non-null value.
- Expected
String Value - (E0204) Expected a string value.
- Field
NotOutput Type - (E0105) Field must be output type.
- Fragment
OnNon Composite Type - (E0314) Fragment definitions must target composite type.
- Implements
NonInterface Type - (E0110) Implemented type must be interface.
- Impossible
Fragment Spread - (E0318) Fragment spread must be possible.
- Incompatible
Response Fields - (E0307) Selection set contains multiple fields with the same name with incompatible selection sets.
- Incompatible
Response Shape - (E0304) Selection set contains multiple fields of incompatible types with the same name.
- Incompatible
Variable - (E0327) Variable must be compatible with usage.
- Incompatible
Variable InFragment - (E0328) Variable must be compatible with usage.
- Input
Value NotInput Type - (E0108) Input value must be input type.
- Invalid
Interface Field Argument Type - (E0114) Type must implement field with argument of same type as interface.
- Lone
Anonymous Operation - (E0301) Anonymous operation definitions must be alone.
- Missing
Argument Colon - (E0007) Argument is missing colon.
- Missing
Argument Value - (E0008) Argument is missing value.
- Missing
Arguments Closing Parentheses - (E0006) Arguments are missing closing parenthesis.
- Missing
Arguments Definition Closing Parenthesis - (E0038) Arguments definition must have a closing parenthesis.
- Missing
Default Value - (E0021) Default value must have a value.
- Missing
Directive Definition At - (E0054) Directive’s name must start with an
@. - Missing
Directive Definition Locations - (E0056) Directive definition must have one or more locations.
- Missing
Directive Definition Name - (E0055) Directive definition must have a name.
- Missing
Directive Name - (E0024) Directive must have a name.
- Missing
Enum Type Definition Name - (E0048) Enum type definition must have a name.
- Missing
Enum Type Extension Name - (E0050) Enum type extension must have a name.
- Missing
Enum Values - (E0121) Enum must have at least one value.
- Missing
Enum Values Closing Brace - (E0049) Enum values must have a closing brace.
- Missing
Field Definition Colon - (E0036) Field definition must have a colon.
- Missing
Field Definition Type - (E0037) Field definition must have a type.
- Missing
Field Name - (E0005) Field must have a name.
- Missing
Fields Definition Closing Brace - (E0035) Fields definition must have a closing brace.
- Missing
First Directive Location - (E0057) Directive definition must have one or more locations.
- Missing
First Implements Interface - (E0033) Implemented interfaces must not be empty.
- Missing
First Union Member Type - (E0045) Union type definition must have one or more member types.
- Missing
Fragment Name - (E0010) Fragment definition must have a name.
- Missing
Fragment Selection Set - (E0012) Fragment definition must have a selection set.
- Missing
Fragment Type Condition - (E0011) Fragment definition must have a type condition.
- Missing
Inherited Interface - (E0111) Type must also implement inherited interfaces.
- Missing
Inline Fragment Selection Set - (E0009) Inline fragment is missing selection set.
- Missing
Input Field - (E0207) Expected a value for required input field.
- Missing
Input Fields Definition Closing Brace - (E0052) Input fields definition must have a closing brace.
- Missing
Input Object Type Definition Name - (E0051) Input object type definition must have a name.
- Missing
Input Object Type Extension Name - (E0053) Input object type extension must have a name.
- Missing
Input Value Definition Colon - (E0039) Input value definition must have a colon.
- Missing
Input Value Definition Type - (E0040) Input value definition must have a type.
- Missing
Interface Field - (E0112) Type must implement field from interface.
- Missing
Interface Field Argument - (E0113) Type must implement field with argument from interface.
- Missing
Interface Type Definition Name - (E0042) Interface type definition must have a name.
- Missing
Interface Type Extension Name - (E0043) Interface type extension must have a name.
- Missing
List Type Closing Bracket - (E0022) List type must have a closing bracket.
- Missing
List Type Wrapped Type - (E0023) List type must wrap another type.
- Missing
List Value Closing Bracket - (E0014) List value must have closing bracket.
- Missing
Object Field Colon - (E0016) Object field must have a colon.
- Missing
Object Field Value - (E0017) Object field must have a value.
- Missing
Object Type Definition Name - (E0032) Object type definition must have a name.
- Missing
Object Type Extension Name - (E0041) Object type extension must have a name.
- Missing
Object Value Closing Brace - (E0015) Object value must have closing brace.
- Missing
Operation Definition Name - (E0002) Operation definition must have a name.
- Missing
Operation Definition Selection Set - (E0003) Operation definition must have a selection set.
- Missing
Required Argument - (E0312) Missing required argument.
- Missing
Root Operation Type Definition Colon - (E0027) Root operation type definition must have a colon.
- Missing
Root Operation Type Definition Named Type - (E0028) Root operation type definition must have a named type.
- Missing
Root Operation Type Definitions - (E0025) Schema definition must define one or more root operation types.
- Missing
Root Operation Type Definitions Closing Brace - (E0026) Root operation type definitions must have a closing brace.
- Missing
Scalar Type Definition Name - (E0029) Scalar type definition must have a name.
- Missing
Scalar Type Extension Directives - (E0031) Scalar type extension must have one or more directives.
- Missing
Scalar Type Extension Name - (E0030) Scalar type extension must have a name.
- Missing
Second Directive Location - (E0058) Directive location must be defined.
- Missing
Second Implements Interface - (E0034) Implemented interface name is missing.
- Missing
Second Union Member Type - (E0046) Union member type must have a name.
- Missing
Selection Set - (E0308) Field of composite type must have selection set.
- Missing
Selection SetClosing Brace - (E0004) Selection set is missing closing curly brace.
- Missing
Type Condition Named Type - (E0013) Type condition must have a named type.
- Missing
Union Members - (E0118) Union must have at least one member type.
- Missing
Union Type Definition Name - (E0044) Union type definition must have a name.
- Missing
Union Type Extension Name - (E0047) Union type extension must have a name.
- Missing
Variable Definition Colon - (E0019) Variable definition must have a colon.
- Missing
Variable Definition Type - (E0020) Variable definition must have a type.
- Missing
Variable Definitions Closing Parenthesis - (E0018) Variable definitions must have a closing parenthesis.
- NonCovariant
Interface Field - (E0116) Implemented type and type from interface must be covariant.
- NonObject
Union Member - (E0120) Union members must be object types.
- Reserved
Directive Name - (E0124) Directive name must not start with
__. - Reserved
Field Name - (E0104) Field name must not start with
__. - Reserved
Input Value Name - (E0107) Input value name must not start with
__. - Self
Referential Directive - (E0125) Directive must not be self-referential.
- Self
Referential Input Type - (E0123) Input type must not be self-referential.
- Self
Referential Interface - (E0117) Interface must not implement itself.
- Undefined
Argument - (E0310) Argument must exist in schema.
- Undefined
Directive - (E0319) Directive must be defined.
- Undefined
Field - (E0303) Queried field does not exist.
- Undefined
Fragment - (E0316) Fragment definition must be defined.
- Undefined
Variable - (E0324) Variables must be defined before they can be used.
- Undefined
Variable InFragment - (E0325) Operations must define variables for all transitively included fragments.
- Unexpected
NonNull Extra Interface Field Argument - (E0115) Type must not require extra arguments for fields implementing interface.
- Unexpected
Selection Set - (E0309) Field of scalar-like type must not have a selection set.
- Unknown
Named Type - (E0100) Named type must exist.
- Unrecognized
Enum Value - (E0209) Enum values must exist in schema definition.
- Unrecognized
Input Field - (E0208) All fields in input object must exist in schema definition.
- Unrecognized
Tokens - (E0001) Syntax error.
- Unsupported
Operation - (E0329) Operation must be defined in schema before it can be used.
- Unused
Fragment Definition - (E0315) Fragment definitions must be used.
- Unused
Variable - (E0326) Variables must be used.
- Variable
Must BeInput Type - (E0323) Variables must be input types.
Enums§
- Diagnostic
- Enum that contains all possible diagnostics that Litho can return.
Traits§
- Diagnostic
Info - Trait implemented by all different diagnostic types that Litho uses.