-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add test to format GTFS API schema #5482
Add test to format GTFS API schema #5482
Conversation
|
||
public class GraphQLFormattingTest { | ||
|
||
public static final File SCHEMA_FILE = new File( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the ResourceLoader
for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok thanks, I thought there was a better way to do this. I Copied the approach I used from the transmodel test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using it but it's not currently usable for writing to files.
This is one approach we can use to apply formatting to the GTFS GraphQL schema. However, we can discuss if this is the best approach or are there other alternatives. Personally I would like the schema to have slightly more space between fields etc. Haven't thought too deeply about the ordering. Note, I haven't yet actually read through the whole schema to figure out if this somehow created some breaking changes. I at least noticed that this now exposes some of the native GraphQL directives through the schema. My instinct is that this is probably a good thing. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5482 +/- ##
=============================================
- Coverage 69.45% 69.45% -0.01%
+ Complexity 17070 17069 -1
=============================================
Files 1937 1937
Lines 73692 73692
Branches 7540 7540
=============================================
- Hits 51184 51182 -2
- Misses 19880 19881 +1
- Partials 2628 2629 +1 ☔ View full report in Codecov by Sentry. |
Another thing to consider, maybe we should include the formatting commit in https://github.com/opentripplanner/OpenTripPlanner/blob/dev-2.x/.git-blame-ignore-revs . However, it also did some other stuff than formatting which I could potentially split out to another commit. |
This is waiting for #5185 to be merged. |
This is in preparation for reformatting the schema file as the graphql library adds these
64d25e3
to
6b715af
Compare
This is now ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order is strange, looked it up in the SchemaPrinter
:
- query
- directive
- object
- enum
- scalar
- interface
- union
- input
Can not see that it is possible to configure it.
Summary
Adds a test that formats GTFS API schema.
Issue
No issue
Unit tests
Formatting is done and checked through a test.
Documentation
Not needed
Changelog
Not sure if needed