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 extensions property to GraphQLResult. #1370

Merged

Conversation

paulkite
Copy link
Contributor

  • Added extensions property to GraphQLResult.
  • Updated references.
  • Implemented tests in ParseQueryResponseTests.

Addresses issue: 1348

- Updated references.
- Implemented tests in ParseQueryResponseTests.
@apollo-cla
Copy link

@paulkite: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

Copy link
Contributor

@designatednerd designatednerd left a comment

Choose a reason for hiding this comment

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

Hi! Sorry I was on vacation last week. Mostly looks good, just one thought.

@@ -72,13 +75,16 @@ public final class GraphQLResponse<Data: GraphQLSelectionSet> {
let data = try decode(selectionSet: Data.self,
from: dataEntry,
variables: variables)
let extensions = body["extensions"] as? JSONObject
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be outside the if let statement since theoretically someone could return stuff in extensions even if data is nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah. Yeah, I was wondering if I was making the right choice there or not. I'll make an update ASAP. Thank you!

- Moved reference to extensions object into function level scope to be able to assign it to the result even if data doesn't exist in the response.
- Updated tests.
Copy link
Contributor

@designatednerd designatednerd left a comment

Choose a reason for hiding this comment

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

🎉 Thanks for the PR!

@designatednerd designatednerd merged commit afa819c into apollographql:main Aug 31, 2020
@designatednerd designatednerd added this to the Next Release milestone Aug 31, 2020
@paulkite paulkite deleted the add-extensions-to-graphqlresult branch October 1, 2020 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants