Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Exclude deprecated fields from the fetched schema #2107

Merged
merged 1 commit into from
May 1, 2019

Conversation

smashwilson
Copy link
Contributor

Please be sure to read the contributor's guide to the GitHub package before submitting any pull requests.

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • Suggestion: You can use checklists to keep track of progress for the sections on metrics, tests, documentation, and user research.

Description of the Change

Inline the introspectionQuery from the graphql package and change the includeDeprecation: arguments to false. This will exclude deprecated fields from the schema we give to relay-compiler, which will in turn give us early notice of us depending on fields which are due to be removed.

Screenshot/Gif

N/A

Alternate Designs

It might be worth making a pull request to the GraphQL package itself to give getIntrospectionQuery() an option to include deprecated fields or not. We'd need to wait for it to be included in a release and for Relay to catch up before we could take advantage of it, though.

Benefits

Early notice of GraphQL schema changes that will affect us. This would help prevent regressions like #2094 from occurring.

Possible Drawbacks

Well... we can't actually merge the schema changes until #2104 is merged 🙃

Applicable Issues

#2094, #2104.

Metrics

N/A

Tests

N/A

Documentation

N/A

Release Notes

N/A

User Experience Research (Optional)

N/A

@codecov
Copy link

codecov bot commented Apr 29, 2019

Codecov Report

Merging #2107 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2107   +/-   ##
=======================================
  Coverage   92.55%   92.55%           
=======================================
  Files         207      207           
  Lines       12021    12021           
  Branches     1746     1746           
=======================================
  Hits        11126    11126           
  Misses        895      895

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4ef8aac...e3fdcf1. Read the comment docs.

@smashwilson smashwilson added graphql schema update Automated pull requests that validate updates to the GraphQL schema. and removed schema update Automated pull requests that validate updates to the GraphQL schema. labels Apr 30, 2019
Copy link
Contributor

@kuychaco kuychaco left a comment

Choose a reason for hiding this comment

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

This looks good to me 👍

I guess it's technically somewhat redundant to #2108, but still seems like a good change!

A couple quick questions to consider before merging:

@smashwilson you indicated N/A for testing in the PR description. It's probably worth doing a quick manual check on the command line just for good measure...

I'm also wondering if there is a way to programmatically modify the includeDeprecated arguments in graphql/utilities's introspectionQuery. Maybe using tree-sitter or some other parsing library? That way we'd get any updates that might be made by the graphql folks. But perhaps it's not worth the effort... Just figured I'd throw the thought out there :)

@smashwilson
Copy link
Contributor Author

I guess it's technically somewhat redundant to #2108, but still seems like a good change!

Yeah, kind of? There's likely a way to share code between them once they're both merged, even.

@smashwilson you indicated N/A for testing in the PR description. It's probably worth doing a quick manual check on the command line just for good measure...

Oh, right, I did check it out manually - I didn't commit the schema changes it made because they broke relay-compiler on account of #2104 not being merged yet. 😄

I'm also wondering if there is a way to programmatically modify the includeDeprecated arguments in graphql/utilities's introspectionQuery.

Oh, interesting idea... I'd thought about sending a pull request to the GraphQL package to add a deprecated parameter to getIntrospectionQuery(), but that stalled a bit when I found out I'd have to do the Facebook CLA thing to contribute. I think we have access to an intermediate representation of the query that we can likely walk and modify... ?

@smashwilson smashwilson merged commit ee081ab into master May 1, 2019
@smashwilson smashwilson deleted the aw/inline-introspection-query branch May 1, 2019 23:37
@smashwilson smashwilson mentioned this pull request May 8, 2019
11 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants