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 classstatic classOptions 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 Stringcapitalize(String name) private voidcheckDirectives(DiffCtx ctx, TypeDefinition oldDef, TypeDefinition newDef) (package private) voidcheckDirectives(DiffCtx ctx, TypeDefinition old, List<Directive> oldDirectives, List<Directive> newDirectives) private voidcheckEnumType(DiffCtx ctx, EnumTypeDefinition oldDef, EnumTypeDefinition newDef) private voidcheckField(DiffCtx ctx, TypeDefinition old, FieldDefinition oldField, FieldDefinition newField) private voidcheckFieldAdditions(DiffCtx ctx, TypeDefinition newDef, Map<String, FieldDefinition> oldFields, Map<String, FieldDefinition> newFields) private voidcheckFieldArg(DiffCtx ctx, TypeDefinition oldDef, FieldDefinition oldField, InputValueDefinition oldArg, InputValueDefinition newArg) private voidcheckFieldArguments(DiffCtx ctx, TypeDefinition oldDef, FieldDefinition oldField, List<InputValueDefinition> oldInputValueDefinitions, List<InputValueDefinition> newInputValueDefinitions) private voidcheckFieldRemovals(DiffCtx ctx, TypeDefinition oldDef, Map<String, FieldDefinition> oldFields, Map<String, FieldDefinition> newFields) private voidcheckFields(DiffCtx ctx, TypeDefinition oldDef, Map<String, FieldDefinition> oldFields, TypeDefinition newDef, Map<String, FieldDefinition> newFields) private voidcheckImplements(DiffCtx ctx, ObjectTypeDefinition old, List<Type> oldImplements, List<Type> newImplements) private voidcheckInputFields(DiffCtx ctx, TypeDefinition old, List<InputValueDefinition> oldIVD, List<InputValueDefinition> newIVD) private voidcheckInputObjectType(DiffCtx ctx, InputObjectTypeDefinition oldDef, InputObjectTypeDefinition newDef) private voidcheckInterfaceType(DiffCtx ctx, InterfaceTypeDefinition oldDef, InterfaceTypeDefinition newDef) private voidcheckObjectType(DiffCtx ctx, ObjectTypeDefinition oldDef, ObjectTypeDefinition newDef) private voidcheckOperation(DiffCtx ctx, String opName, Optional<SchemaDefinition> oldSchemaDef, Optional<SchemaDefinition> newSchemaDef) private voidcheckScalarType(DiffCtx ctx, ScalarTypeDefinition oldDef, ScalarTypeDefinition newDef) private void(package private) DiffCategorycheckTypeWithNonNullAndListOnInputOrArg(Type oldType, Type newType) (package private) DiffCategorycheckTypeWithNonNullAndListOnObjectOrInterface(Type oldType, Type newType) private voidcheckUnionType(DiffCtx ctx, UnionTypeDefinition oldDef, UnionTypeDefinition newDef) intdiffSchema(DiffSet diffSet, DifferenceReporter reporter) Deprecated.intdiffSchema(SchemaDiffSet schemaDiffSet, DifferenceReporter reporter) This will perform a difference on the two schemas.private voiddiffSchemaImpl(Document oldDoc, Document newDoc, DifferenceReporter reporter) private Optional<OperationTypeDefinition> getOpDef(String opName, SchemaDefinition schemaDef) private Optional<SchemaDefinition> getSchemaDef(Document document) (package private) static StringgetTypeName(Type type) private booleanisDeprecated(DirectivesContainer<?> node) private booleanisReservedType(String typeName) private booleanisSystemScalar(String typeName) private Stringprivate 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
-