Comments (3)
Thanks for bringing this up!
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?
Interesting. I feel like any change in the description string is indeed a change 🤔
you can't use graphql-schema_comparator any more because it always detects a change, even if there isn't one.
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?
from graphql-schema_comparator.
Consider this test for RSpec
it "looks if graphql schema has changed" do
old_schema = File.read(Rails.root.join("schema.graphql"))
new_schema = MySchema.to_graphql
result = GraphQL::SchemaComparator.compare(old_schema, new_schema)
expect(result).to be_identical
end
When we have a change in the GraphQL schema, we dump it with rails graphql:schema:idl
. When we have a long description, it get's dumped with new lines into the schema.graphql
file. When you re-read it in the spec to check if there are changes, the MySchema.to_graphql
has NO new lines, but the schema read from schema.graphql
has the new lines.
So it detects a change, even if there is none. Do you know what I mean?
from graphql-schema_comparator.
Ran into this issue myself just now: a couple of our fields have long enough descriptions that they are word wrapped in the schema.graphql
file, but the GraphQL Schema object does not include the wrapping.
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
from graphql-schema_comparator.
Related Issues (20)
- Some nullability changes being reported as breaking HOT 2
- Dangerous changes HOT 3
- Nuance to EnumValueAdded's criticality HOT 1
- Node.js (npm) wrapper HOT 1
- CC BY 4.0 License HOT 1
- Support graphql-ruby 1.10.0 HOT 4
- Comparison of directive argument fails HOT 1
- "Type `Int` was added" (failing test on master) HOT 1
- Changing an object to an interface isn't necessarily breaking HOT 2
- Trigger nested changes to new types and fields
- Don't treat adding a required argument with a default value as a breaking change HOT 5
- Don't treat a non-null input type field changing to nullable input type field as a breaking change HOT 2
- Field argument change to/from `default_value = nil` not detected
- Extended Query being reported as a different to a non-extended Query, when it is actually the same. HOT 2
- Deprecated .to_graphql method in the newest version of the graphql gem
- unchanged directive marked as breaking change
- Support argument deprecations
- Change message regressions on 1.1.1 HOT 2
- Safe nullability changes are marked unsafe incorrectly HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-schema_comparator.