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

Update test fixtures to use string descriptions where tested #153

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

rmosolgo
Copy link
Contributor

@rmosolgo rmosolgo commented Jul 8, 2024

👋 I saw that some tests were skipped on GraphQL-Ruby v2.2+, so I took a look into it.

It looks like the new Ruby parser broke it. The old parser supported comments-as-descriptions, but the new parser doesn't. So these tests for descriptions started failing.

I updated these example to use strings instead of comments so that the tests would keep passing. (Strings have been the only "official" format for descriptions since 2018 or so: graphql/graphql-spec#420.)

To update the whole example, we could probably use GraphQL-Ruby 2.1.x do something like GraphQL::Schema.from_definition(...).to_definition to generate a new, spec-compliant schema definition file.

What do you think of this approach? Would it be helpful to update all the fixtures to the current format?

brettchalupa
brettchalupa previously approved these changes Jul 8, 2024
Copy link
Owner

@brettchalupa brettchalupa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmosolgo thank you so much! This makes a lot of sense and helps me understand what changed and why. Updating and validating the fixture schemas would be great, and I could even see adding that to the CI checks to ensure we're valid moving forward.

Would you want to take that on or want me to? Either way. Your contribution is much appreciated, and thanks for your work on graphql-ruby!

@rmosolgo
Copy link
Contributor Author

rmosolgo commented Jul 9, 2024

Sure thing, happy to! I used this script to regenerate the files:

require 'bundler/inline'

gemfile(true) do
  gem 'graphql', '~>2.1.0'
end

Dir.glob('test/graphql-docs/fixtures/*.graphql').each do |file|
  puts "Transforming #{file}"
  prev_sdl = File.read(file)
  new_sdl = GraphQL::Schema.from_definition(prev_sdl).to_definition
  File.write(file, new_sdl)
  puts '  Done'
end

Then pushed the changes here.

@brettchalupa brettchalupa merged commit ac76ff9 into brettchalupa:main Jul 9, 2024
3 checks passed
@brettchalupa
Copy link
Owner

Thanks again @rmosolgo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants