compare

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GroupChanges

func GroupChanges(changes []*Change) map[Criticality][]*Change

GroupChanges group all changes on their criticality level

func ReportBreakingChanges

func ReportBreakingChanges(changes []*Change, withFilepath bool) int

ReportBreakingChanges print only breaking changes in output

func ReportDangerousChanges

func ReportDangerousChanges(changes []*Change, withFilepath bool) int

ReportDangerousChanges print only breaking changes in output

func ReportNonBreakingChanges

func ReportNonBreakingChanges(changes []*Change, withFilepath bool) int

ReportNonBreakingChanges print only breaking changes in output

Types

type Change

type Change struct {
	// contains filtered or unexported fields
}

Change defines a change in schema

func FindChangesInSchemas

func FindChangesInSchemas(oldSchema *ast.SchemaDocument, newSchema *ast.SchemaDocument) []*Change

FindChangesInSchemas compares two schemas, returns the list of all changes made in the second schema

func (*Change) GetChangeCriticalityLevel added in v0.3.0

func (c *Change) GetChangeCriticalityLevel() Criticality

GetChangeCriticalityLevel get change criticality level

func (*Change) GetChangeType added in v0.3.0

func (c *Change) GetChangeType() ChangeType

GetChangeType get change type

func (*Change) GetMessage added in v0.3.0

func (c *Change) GetMessage() string

GetMessage get change message

func (*Change) GetPath added in v0.3.0

func (c *Change) GetPath() string

GetPath get change path

func (*Change) GetPosition added in v0.3.0

func (c *Change) GetPosition() *ast.Position

GetPosition get change position

type ChangeType

type ChangeType string

ChangeType enum to list all type of breaking/non-breaking/dangerous changes

const (
	// FieldArgumentDescriptionChanged Field Argument Description Changed
	FieldArgumentDescriptionChanged ChangeType = "FIELD_ARGUMENT_DESCRIPTION_CHANGED"
	// FieldArgumentDefaultChanged Field Argument Default Changed
	FieldArgumentDefaultChanged ChangeType = "FIELD_ARGUMENT_DEFAULT_CHANGED"
	// FieldArgumentTypeChanged Field Argument Type Changed
	FieldArgumentTypeChanged ChangeType = "FIELD_ARGUMENT_TYPE_CHANGED"
	// DirectiveRemoved Directive Removed
	DirectiveRemoved ChangeType = "DIRECTIVE_REMOVED"
	// DirectiveChanged Directive changed
	DirectiveChanged ChangeType = "DIRECTIVE_CHANGED"
	// DirectiveAdded Directive Added
	DirectiveAdded ChangeType = "DIRECTIVE_ADDED"
	// DirectiveDescriptionChanged Directive Description Changed
	DirectiveDescriptionChanged ChangeType = "DIRECTIVE_DESCRIPTION_CHANGED"
	// DirectiveLocationAdded Directive Location Added
	DirectiveLocationAdded ChangeType = "DIRECTIVE_LOCATION_ADDED"
	// DirectiveLocationRemoved Directive Location Removed
	DirectiveLocationRemoved ChangeType = "DIRECTIVE_LOCATION_REMOVED"
	// DirectiveArgumentAdded Directive Argument Added
	DirectiveArgumentAdded ChangeType = "DIRECTIVE_ARGUMENT_ADDED"
	// DirectiveArgumentRemoved Directive Argument Removed
	DirectiveArgumentRemoved ChangeType = "DIRECTIVE_ARGUMENT_REMOVED"
	// DirectiveArgumentDescriptionChanged Directive Argument Description Changed
	DirectiveArgumentDescriptionChanged ChangeType = "DIRECTIVE_ARGUMENT_DESCRIPTION_CHANGED"
	// DirectiveArgumentDefaultValueChanged Directive Argument Default Value Changed
	DirectiveArgumentDefaultValueChanged ChangeType = "DIRECTIVE_ARGUMENT_DEFAULT_VALUE_CHANGED"
	// DirectiveArgumentTypeChanged Directive Argument Type Changed
	DirectiveArgumentTypeChanged ChangeType = "DIRECTIVE_ARGUMENT_TYPE_CHANGED"
	// DirectiveRepeatableRemoved Directive Repeatable Removed
	DirectiveRepeatableRemoved ChangeType = "DIRECTIVE_REPEATABLE_REMOVED"
	// DirectiveRepeatableAdded Directive Repeatable Added
	DirectiveRepeatableAdded ChangeType = "DIRECTIVE_REPEATABLE_ADDED"
	// DirectiveArgumentValueChanged Directive Argument Value Changed
	DirectiveArgumentValueChanged ChangeType = "DIRECTIVE_ARGUMENT_VALUE_CHANGED"
	// EnumValueRemoved Enum Value Removed
	EnumValueRemoved ChangeType = "ENUM_VALUE_REMOVED"
	// EnumValueAdded Enum Value Added
	EnumValueAdded ChangeType = "ENUM_VALUE_ADDED"
	// EnumValueDescriptionChanged Enum Value Description Changed
	EnumValueDescriptionChanged ChangeType = "ENUM_VALUE_DESCRIPTION_CHANGED"
	// EnumValueDeprecationReasonChanged Enum Value Deprecation Reason Changed
	EnumValueDeprecationReasonChanged ChangeType = "ENUM_VALUE_DEPRECATION_REASON_CHANGED"
	// EnumValueDeprecationAdded Enum Value Deprecation Added
	EnumValueDeprecationAdded ChangeType = "ENUM_VALUE_DEPRECATION_ADDED"
	// FieldRemoved Field Removed
	FieldRemoved ChangeType = "FIELD_REMOVED"
	// FieldAdded Field Added
	FieldAdded ChangeType = "FIELD_ADDED"
	// FieldDescriptionChanged Field Description Changed
	FieldDescriptionChanged ChangeType = "FIELD_DESCRIPTION_CHANGED"
	// FieldDeprecationAdded Field Deprecation Added
	FieldDeprecationAdded ChangeType = "FIELD_DEPRECATION_ADDED"
	// FieldDeprecationRemoved Field Deprecation Removed
	FieldDeprecationRemoved ChangeType = "FIELD_DEPRECATION_REMOVED"
	// FieldDeprecationReasonChanged Field Deprecation Reason Changed
	FieldDeprecationReasonChanged ChangeType = "FIELD_DEPRECATION_REASON_CHANGED"
	// FieldTypeChanged Field Type Changed
	FieldTypeChanged ChangeType = "FIELD_TYPE_CHANGED"
	// FieldArgumentAdded Field Argument Added
	FieldArgumentAdded ChangeType = "FIELD_ARGUMENT_ADDED"
	// FieldArgumentRemoved Field Argument Removed
	FieldArgumentRemoved ChangeType = "FIELD_ARGUMENT_REMOVED"
	// InputFieldRemoved Input Field Removed
	InputFieldRemoved ChangeType = "INPUT_FIELD_REMOVED"
	// InputFieldAdded Input Field Added
	InputFieldAdded ChangeType = "INPUT_FIELD_ADDED"
	// InputFieldDescriptionChanged Input Field Description Changed
	InputFieldDescriptionChanged ChangeType = "INPUT_FIELD_DESCRIPTION_CHANGED"
	// InputFieldDefaultValueChanged Input Field Default Value Changed
	InputFieldDefaultValueChanged ChangeType = "INPUT_FIELD_DEFAULT_VALUE_CHANGED"
	// InputFieldTypeChanged Input Field Type Changed
	InputFieldTypeChanged ChangeType = "INPUT_FIELD_TYPE_CHANGED"
	// ObjectTypeInterfaceAdded Object Type Interface Added
	ObjectTypeInterfaceAdded ChangeType = "OBJECT_TYPE_INTERFACE_ADDED"
	// InputFieldDeprecationAdded Field Deprecation Added
	InputFieldDeprecationAdded ChangeType = "INPUT_FIELD_DEPRECATION_ADDED"
	// InputFieldDeprecationRemoved Field Deprecation Removed
	InputFieldDeprecationRemoved ChangeType = "INPUT_FIELD_DEPRECATION_REMOVED"
	// InputFieldDeprecationReasonChanged Field Deprecation Reason Changed
	InputFieldDeprecationReasonChanged ChangeType = "INPUT_FIELD_DEPRECATION_REASON_CHANGED"
	// ObjectTypeInterfaceRemoved Object Type Interface Removed
	ObjectTypeInterfaceRemoved ChangeType = "OBJECT_TYPE_INTERFACE_REMOVED"
	// SchemaQueryTypeChanged Schema Query Type Changed
	SchemaQueryTypeChanged ChangeType = "SCHEMA_QUERY_TYPE_CHANGED"
	// SchemaMutationTypeChanged Schema Mutation Type Changed
	SchemaMutationTypeChanged ChangeType = "SCHEMA_MUTATION_TYPE_CHANGED"
	// SchemaSubscriptionTypeChanged Schema Subscription Type Changed
	SchemaSubscriptionTypeChanged ChangeType = "SCHEMA_SUBSCRIPTION_TYPE_CHANGED"
	// TypeRemoved Type Removed
	TypeRemoved ChangeType = "TYPE_REMOVED"
	// TypeAdded Type Added
	TypeAdded ChangeType = "TYPE_ADDED"
	// TypeKindChanged Type Kind Changed
	TypeKindChanged ChangeType = "TYPE_KIND_CHANGED"
	// TypeDescriptionChanged Type Description Changed
	TypeDescriptionChanged ChangeType = "TYPE_DESCRIPTION_CHANGED"
	// UnionMemberRemoved Union Member Removed
	UnionMemberRemoved ChangeType = "UNION_MEMBER_REMOVED"
	// UnionMemberAdded Union Member Added
	UnionMemberAdded ChangeType = "UNION_MEMBER_ADDED"
)

type Criticality

type Criticality int

Criticality severity of a change in schema

const (
	// NonBreaking Change is compatible with previous version
	NonBreaking Criticality = 0
	// Dangerous Change is compatible with previous version but can result in unexpected behavior for consumer
	Dangerous Criticality = 1
	// Breaking Change is incompatible with previous version
	Breaking Criticality = 2
)

func (Criticality) String added in v0.3.0

func (c Criticality) String() string

string get change criticality level string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL