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

Add test to format GTFS API schema #5482

Merged
merged 6 commits into from
Jul 3, 2024

Conversation

optionsome
Copy link
Member

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

@optionsome optionsome added the Improvement A functional improvement label Nov 6, 2023
@optionsome optionsome added this to the 2.5 (next release) milestone Nov 6, 2023
@optionsome optionsome requested a review from a team as a code owner November 6, 2023 12:56

public class GraphQLFormattingTest {

public static final File SCHEMA_FILE = new File(
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

@optionsome
Copy link
Member Author

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.

Copy link

codecov bot commented Nov 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.45%. Comparing base (23f04a0) to head (2123d64).

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.
📢 Have feedback on the report? Share it here.

@optionsome
Copy link
Member Author

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.

@optionsome optionsome marked this pull request as draft November 9, 2023 11:05
@optionsome
Copy link
Member Author

This is waiting for #5185 to be merged.

@t2gran t2gran modified the milestones: 2.5, 2.6 (next release) Mar 13, 2024
@optionsome optionsome marked this pull request as ready for review June 13, 2024 15:28
@optionsome
Copy link
Member Author

This is now ready for review.

@leonardehrenfried leonardehrenfried requested review from t2gran and removed request for vesameskanen July 2, 2024 08:28
Copy link
Member

@t2gran t2gran left a 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.

@optionsome optionsome merged commit 2a5c8be into opentripplanner:dev-2.x Jul 3, 2024
5 checks passed
@optionsome optionsome deleted the schema-formatting branch July 3, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement A functional improvement Skip Changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants