Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort types in generated schema #407

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/graphiti/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions spec/schema_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading