diff --git a/lib/graphiti/schema.rb b/lib/graphiti/schema.rb index 2b9de392..b74a9314 100644 --- a/lib/graphiti/schema.rb +++ b/lib/graphiti/schema.rb @@ -42,7 +42,7 @@ def generate def generate_types {}.tap do |types| - Graphiti::Types.map.each_pair do |name, config| + Graphiti::Types.map.sort.each_entry do |name, config| types[name] = config.slice(:kind, :description) end end diff --git a/spec/schema_spec.rb b/spec/schema_spec.rb index 282a4b58..bd8fbea7 100644 --- a/spec/schema_spec.rb +++ b/spec/schema_spec.rb @@ -244,6 +244,10 @@ def self.name expect(schema[:types]).to eq(expected[:types]) end + it "has sorted types" do + expect(schema[:types].to_a).to eq(expected[:types].sort) + end + # Dynamically-created resources, e.g. remote resources context "when resource has missing name" do let(:no_name) do