Package graphql.schema.diff
Class SchemaDiff
java.lang.Object
graphql.schema.diff.SchemaDiff
The SchemaDiff is called with a
DiffSet
and will report the
differences in the graphql schema APIs by raising events to a
DifferenceReporter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
static class
Options for controlling the diffing process -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a differ using default optionsSchemaDiff
(SchemaDiff.Options options) Constructs a differ with the specified options -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
capitalize
(String name) private void
checkDirectives
(DiffCtx ctx, TypeDefinition oldDef, TypeDefinition newDef) (package private) void
checkDirectives
(DiffCtx ctx, TypeDefinition old, List<Directive> oldDirectives, List<Directive> newDirectives) private void
checkEnumType
(DiffCtx ctx, EnumTypeDefinition oldDef, EnumTypeDefinition newDef) private void
checkField
(DiffCtx ctx, TypeDefinition old, FieldDefinition oldField, FieldDefinition newField) private void
checkFieldAdditions
(DiffCtx ctx, TypeDefinition newDef, Map<String, FieldDefinition> oldFields, Map<String, FieldDefinition> newFields) private void
checkFieldArg
(DiffCtx ctx, TypeDefinition oldDef, FieldDefinition oldField, InputValueDefinition oldArg, InputValueDefinition newArg) private void
checkFieldArguments
(DiffCtx ctx, TypeDefinition oldDef, FieldDefinition oldField, List<InputValueDefinition> oldInputValueDefinitions, List<InputValueDefinition> newInputValueDefinitions) private void
checkFieldRemovals
(DiffCtx ctx, TypeDefinition oldDef, Map<String, FieldDefinition> oldFields, Map<String, FieldDefinition> newFields) private void
checkFields
(DiffCtx ctx, TypeDefinition oldDef, Map<String, FieldDefinition> oldFields, TypeDefinition newDef, Map<String, FieldDefinition> newFields) private void
checkImplements
(DiffCtx ctx, ObjectTypeDefinition old, List<Type> oldImplements, List<Type> newImplements) private void
checkInputFields
(DiffCtx ctx, TypeDefinition old, List<InputValueDefinition> oldIVD, List<InputValueDefinition> newIVD) private void
checkInputObjectType
(DiffCtx ctx, InputObjectTypeDefinition oldDef, InputObjectTypeDefinition newDef) private void
checkInterfaceType
(DiffCtx ctx, InterfaceTypeDefinition oldDef, InterfaceTypeDefinition newDef) private void
checkObjectType
(DiffCtx ctx, ObjectTypeDefinition oldDef, ObjectTypeDefinition newDef) private void
checkOperation
(DiffCtx ctx, String opName, Optional<SchemaDefinition> oldSchemaDef, Optional<SchemaDefinition> newSchemaDef) private void
checkScalarType
(DiffCtx ctx, ScalarTypeDefinition oldDef, ScalarTypeDefinition newDef) private void
(package private) DiffCategory
checkTypeWithNonNullAndListOnInputOrArg
(Type oldType, Type newType) (package private) DiffCategory
checkTypeWithNonNullAndListOnObjectOrInterface
(Type oldType, Type newType) private void
checkUnionType
(DiffCtx ctx, UnionTypeDefinition oldDef, UnionTypeDefinition newDef) int
diffSchema
(DiffSet diffSet, DifferenceReporter reporter) Deprecated.int
diffSchema
(SchemaDiffSet schemaDiffSet, DifferenceReporter reporter) This will perform a difference on the two schemas.private void
diffSchemaImpl
(Document oldDoc, Document newDoc, DifferenceReporter reporter) private Optional
<OperationTypeDefinition> getOpDef
(String opName, SchemaDefinition schemaDef) private Optional
<SchemaDefinition> getSchemaDef
(Document document) (package private) static String
getTypeName
(Type type) private boolean
isDeprecated
(DirectivesContainer<?> node) private boolean
isReservedType
(String typeName) private boolean
isSystemScalar
(String typeName) private String
private Optional
<OperationTypeDefinition> synthOperationTypeDefinition
(Function<Type, Optional<ObjectTypeDefinition>> typeRetriever, String opName)
-
Field Details
-
options
-
SYSTEM_SCALARS
-
-
Constructor Details
-
SchemaDiff
public SchemaDiff()Constructs a differ using default options -
SchemaDiff
Constructs a differ with the specified options- Parameters:
options
- the controlling options
-
-
Method Details
-
diffSchema
Deprecated.This will perform a difference on the two schemas. The reporter callback interface will be called when differences are encountered.- Parameters:
diffSet
- the two schemas to compare for differencereporter
- the place to report difference events to- Returns:
- the number of API breaking changes
-
diffSchema
This will perform a difference on the two schemas. The reporter callback interface will be called when differences are encountered.- Parameters:
schemaDiffSet
- the two schemas to compare for differencereporter
- the place to report difference events to- Returns:
- the number of API breaking changes
-
diffSchemaImpl
-
checkOperation
private void checkOperation(DiffCtx ctx, String opName, Optional<SchemaDefinition> oldSchemaDef, Optional<SchemaDefinition> newSchemaDef) -
checkType
-
isDeprecated
-
isReservedType
-
isSystemScalar
-
checkObjectType
-
checkInterfaceType
private void checkInterfaceType(DiffCtx ctx, InterfaceTypeDefinition oldDef, InterfaceTypeDefinition newDef) -
checkUnionType
-
checkInputObjectType
private void checkInputObjectType(DiffCtx ctx, InputObjectTypeDefinition oldDef, InputObjectTypeDefinition newDef) -
checkInputFields
private void checkInputFields(DiffCtx ctx, TypeDefinition old, List<InputValueDefinition> oldIVD, List<InputValueDefinition> newIVD) -
checkEnumType
-
checkScalarType
-
checkImplements
-
checkFields
private void checkFields(DiffCtx ctx, TypeDefinition oldDef, Map<String, FieldDefinition> oldFields, TypeDefinition newDef, Map<String, FieldDefinition> newFields) -
checkFieldRemovals
private void checkFieldRemovals(DiffCtx ctx, TypeDefinition oldDef, Map<String, FieldDefinition> oldFields, Map<String, FieldDefinition> newFields) -
checkFieldAdditions
private void checkFieldAdditions(DiffCtx ctx, TypeDefinition newDef, Map<String, FieldDefinition> oldFields, Map<String, FieldDefinition> newFields) -
checkField
private void checkField(DiffCtx ctx, TypeDefinition old, FieldDefinition oldField, FieldDefinition newField) -
checkFieldArguments
private void checkFieldArguments(DiffCtx ctx, TypeDefinition oldDef, FieldDefinition oldField, List<InputValueDefinition> oldInputValueDefinitions, List<InputValueDefinition> newInputValueDefinitions) -
checkFieldArg
private void checkFieldArg(DiffCtx ctx, TypeDefinition oldDef, FieldDefinition oldField, InputValueDefinition oldArg, InputValueDefinition newArg) -
checkDirectives
-
checkDirectives
-
checkTypeWithNonNullAndListOnInputOrArg
-
checkTypeWithNonNullAndListOnObjectOrInterface
-
getTypeName
-
getSchemaDef
-
getOpDef
-
synthOperationTypeDefinition
private Optional<OperationTypeDefinition> synthOperationTypeDefinition(Function<Type, Optional<ObjectTypeDefinition>> typeRetriever, String opName) -
sortedMap
-
capitalize
-
mkDotName
-