graphql_schema_diff/
change.rs

1/// A change that represents a meaningful difference between the two schemas. Changes have a
2/// direction: from source to target. For example, if `kind` is `AddField`, it means the field does
3/// not exist in the `source` schema but it does exist in the `target` schema.
4#[derive(Clone, Eq, PartialEq, Hash, Ord, PartialOrd, Debug)]
5#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6pub struct Change {
7    // /!\ The order of fields matters for the PartialOrd derive /!\
8    /// Where the change happened in the schema. It is dot separated where relevant. For example if
9    /// the change happened in a field argument, the path will be something like
10    /// `ParentTypeName.fieldName.argumentName`.
11    pub path: String,
12    /// The nature of the change.
13    pub kind: ChangeKind,
14}
15
16#[derive(Copy, Clone, Eq, PartialEq, Hash, Ord, PartialOrd, Debug)]
17#[allow(missing_docs)]
18#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
19#[repr(u8)]
20pub enum ChangeKind {
21    // /!\ The order of variants matters for the PartialOrd derive /!\
22    ChangeQueryType,
23    ChangeMutationType,
24    ChangeSubscriptionType,
25    RemoveObjectType,
26    AddObjectType,
27    AddInterfaceImplementation,
28    RemoveInterfaceImplementation,
29    ChangeFieldType,
30    RemoveField,
31    AddField,
32    AddUnion,
33    RemoveUnion,
34    AddUnionMember,
35    RemoveUnionMember,
36    AddEnum,
37    RemoveEnum,
38    AddEnumValue,
39    RemoveEnumValue,
40    AddScalar,
41    RemoveScalar,
42    AddInterface,
43    RemoveInterface,
44    AddDirectiveDefinition,
45    RemoveDirectiveDefinition,
46    AddSchemaDefinition,
47    RemoveSchemaDefinition,
48    AddInputObject,
49    RemoveInputObject,
50    AddFieldArgument,
51    RemoveFieldArgument,
52    AddFieldArgumentDefault,
53    RemoveFieldArgumentDefault,
54    ChangeFieldArgumentDefault,
55    ChangeFieldArgumentType,
56}