Class: GraphQL::SchemaComparator::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/schema_comparator/result.rb

Overview

The result of a comparison between two schema versions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(changes) ⇒ Result

Returns a new instance of Result.



7
8
9
10
11
12
# File 'lib/graphql/schema_comparator/result.rb', line 7

def initialize(changes)
  @changes = changes.sort_by(&:criticality).reverse
  @breaking_changes = @changes.select(&:breaking?)
  @non_breaking_changes = @changes.select(&:non_breaking?)
  @dangerous_changes = @changes.select(&:dangerous?)
end

Instance Attribute Details

#breaking_changesObject (readonly)

Returns the value of attribute breaking_changes.



5
6
7
# File 'lib/graphql/schema_comparator/result.rb', line 5

def breaking_changes
  @breaking_changes
end

#changesObject (readonly)

Returns the value of attribute changes.



5
6
7
# File 'lib/graphql/schema_comparator/result.rb', line 5

def changes
  @changes
end

#dangerous_changesObject (readonly)

Returns the value of attribute dangerous_changes.



5
6
7
# File 'lib/graphql/schema_comparator/result.rb', line 5

def dangerous_changes
  @dangerous_changes
end

#non_breaking_changesObject (readonly)

Returns the value of attribute non_breaking_changes.



5
6
7
# File 'lib/graphql/schema_comparator/result.rb', line 5

def non_breaking_changes
  @non_breaking_changes
end

Instance Method Details

#breaking?Boolean

If there was a breaking change between the two schema versions

Returns:

  • (Boolean)


22
23
24
# File 'lib/graphql/schema_comparator/result.rb', line 22

def breaking?
  breaking_changes.any?
end

#identical?Boolean

If the two schemas were identical

Returns:

  • (Boolean)


16
17
18
# File 'lib/graphql/schema_comparator/result.rb', line 16

def identical?
  @changes.empty?
end