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

fix: refactor GraphQL response decoder #971

Merged
merged 2 commits into from
Dec 18, 2020
Merged

fix: refactor GraphQL response decoder #971

merged 2 commits into from
Dec 18, 2020

Conversation

lawmicha
Copy link
Contributor

Issue #, if available:

Description of changes:
This refactors the GraphQL decoder code to isolate decoding logic into decodeToResponseType() in anticipation of pagination support decoding

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@lawmicha lawmicha requested a review from diegocstn December 14, 2020 22:17
@codecov
Copy link

codecov bot commented Dec 14, 2020

Codecov Report

Merging #971 (409357f) into main (492c0a3) will increase coverage by 0.19%.
The diff coverage is 81.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #971      +/-   ##
==========================================
+ Coverage   54.59%   54.78%   +0.19%     
==========================================
  Files         631      634       +3     
  Lines       18371    18372       +1     
==========================================
+ Hits        10030    10066      +36     
+ Misses       8341     8306      -35     
Flag Coverage Δ
API_plugin_unit_test 47.97% <81.87%> (+2.15%) ⬆️
AWSPluginsCore 72.41% <ø> (ø)
Amplify 45.79% <ø> (ø)
Analytics_plugin_unit_test 73.23% <ø> (ø)
Auth_plugin_unit_test 67.34% <ø> (ø)
DataStore_plugin_unit_test 71.02% <ø> (ø)
Predictions_plugin_unit_test 33.48% <ø> (ø)
Storage_plugin_unit_test 57.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...oryPlugin/Support/Decode/GraphQLErrorDecoder.swift 70.73% <0.00%> (ø)
...Plugin/Support/Decode/GraphQLResponseDecoder.swift 72.41% <72.41%> (ø)
...n/Support/Internal/AWSAppSyncGraphQLResponse.swift 86.00% <86.00%> (ø)
...ort/Decode/GraphQLResponseDecoder+DecodeData.swift 86.95% <86.95%> (ø)
...ICategoryPlugin/AWSAPIPlugin+GraphQLBehavior.swift 100.00% <100.00%> (ø)
...n/Operation/AWSGraphQLOperation+APIOperation.swift 47.27% <100.00%> (-3.58%) ⬇️
...CategoryPlugin/Operation/AWSGraphQLOperation.swift 60.75% <100.00%> (ø)
...in/Operation/AWSGraphQLSubscriptionOperation.swift 70.17% <100.00%> (-0.77%) ⬇️
...port/Utils/GraphQLRequest+toOperationRequest.swift 100.00% <100.00%> (ø)
... and 4 more

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 492c0a3...409357f. Read the comment docs.

@lawmicha lawmicha self-assigned this Dec 18, 2020
@lawmicha lawmicha added the api Issues related to the API category label Dec 18, 2020
Base automatically changed from fix/blogpostcomment to main December 18, 2020 21:36
@lawmicha lawmicha force-pushed the fix/api-refactor branch 4 times, most recently from 44b6433 to 05c4649 Compare December 18, 2020 22:10
do {
let errors = try getAPIErrors(from: jsonObject)
let data = try getGraphQLData(from: jsonObject)
switch (data, errors) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nice! :)

@lawmicha lawmicha merged commit 0f10e94 into main Dec 18, 2020
@lawmicha lawmicha deleted the fix/api-refactor branch December 18, 2020 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues related to the API category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants