-
Notifications
You must be signed in to change notification settings - Fork 28
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
Descriptions with new lines are listed as SafeChange #27
Comments
Thanks for bringing this up!
Interesting. I feel like any change in the description string is indeed a change 🤔
I'm trying to understand why you can't use it anymore. The first time you change to a description with new line, I would expect there would be description changes, but once you merge, I feel like there would be no more changes the next time? Am I getting this right? |
Consider this test for RSpec
When we have a change in the GraphQL schema, we dump it with So it detects a change, even if there is none. Do you know what I mean? |
Ran into this issue myself just now: a couple of our fields have long enough descriptions that they are word wrapped in the We had to work around this issue by explicitly ignoring specific "changes" that would incorrectly get flagged due to the descriptions being text-wrapped in the schema dump, which is brittle thing that it would be better not to have to maintain: false_alarm = true
compare_result.changes.each do |change|
if change.is_a?(GraphQL::SchemaComparator::Changes::InputFieldDescriptionChanged) &&
change.old_field.description.tr("\n", " ") == change.new_field.description
# This is a false alarm non-change due to text formatting done when dumping
# to the schema.graphql file for long descriptions, so we skip it
next
end
if change.is_a?(GraphQL::SchemaComparator::Changes::FieldArgumentDescriptionChanged) &&
change.old_argument.description.tr("\n", " ") == change.new_argument.description
# This is a false alarm non-change due to text formatting done when dumping
# to the schema.graphql file for long descriptions, so we skip it
next
end
puts " #{change.message}"
false_alarm = false
end |
When using long descriptions, e.g.
and dumping the schema, it looks like this
because of the formatting in
GraphQL::Language::BlockString
, which adds a new line after a certain amount of characters.Unfortunately, graphql-schema_comparator lists this new line as a change
So now, you can't use graphql-schema_comparator any more because it always detects a change, even if there isn't one.
Would it be possible to ignore such new lines in descriptions? Or would it be better to not include newlines in the schema, and fix this on graphql-ruby gem side?
The text was updated successfully, but these errors were encountered: