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

feature(amplify_api): Graphql helpers, include parent and decode nested/parent values #1055

Merged
merged 27 commits into from
Nov 11, 2021
Merged

Conversation

ragingsquirrel3
Copy link
Contributor

@ragingsquirrel3 ragingsquirrel3 commented Nov 8, 2021

This PR contains additional functionality for child/parent models in API graphql helpers.

  • for all model helpers in models with a parent, include the full parent's selection set in the selection set (up 1 level)
  • In the response decoder, decode recursively nested parents/children in the event a custom request is nested that way

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Travis Sheppard added 22 commits October 6, 2021 10:37
…sted models from mutations, integ tests pass, still need to update queries and test them
…els with belongsTo, transform JSON in response for parents and children
@codecov-commenter
Copy link

codecov-commenter commented Nov 9, 2021

Codecov Report

Merging #1055 (2cbe76d) into feature/graphql_helpers_updated (d05cd47) will increase coverage by 0.13%.
The diff coverage is 94.52%.

@@                         Coverage Diff                         @@
##           feature/graphql_helpers_updated    #1055      +/-   ##
===================================================================
+ Coverage                            66.63%   66.77%   +0.13%     
===================================================================
  Files                                  294      295       +1     
  Lines                                10020    10065      +45     
  Branches                               396      396              
===================================================================
+ Hits                                  6677     6721      +44     
- Misses                                3203     3204       +1     
  Partials                               140      140              
Flag Coverage Δ
android-unit-tests 63.27% <ø> (ø)
flutter-unit-tests 59.97% <94.52%> (+0.68%) ⬆️
ios-unit-tests 71.47% <ø> (ø)

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

Impacted Files Coverage Δ
packages/amplify_api/lib/src/graphql/utils.dart 92.85% <92.85%> (ø)
...y_api/lib/src/graphql/graphql_request_factory.dart 86.77% <100.00%> (+0.85%) ⬆️
..._api/lib/src/graphql/graphql_response_decoder.dart 81.48% <100.00%> (+2.31%) ⬆️

@ragingsquirrel3 ragingsquirrel3 marked this pull request as ready for review November 9, 2021 18:24
@ragingsquirrel3 ragingsquirrel3 requested a review from a team as a code owner November 9, 2021 18:24
Copy link
Contributor

@fjnoyp fjnoyp left a comment

Choose a reason for hiding this comment

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

Everything looks good thanks for making these changes. Just left one question.

'rating': 0,
'comments': [
{
'serializedData': {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for writing all of the code to translate between JSON formats. Do you think it would have been better if we changed our own JSON instead to ensure total uniformity of JSON.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

long-term, aligning would be better, just don't have time right now to reconcile the datastore part and add extra codegen logic. This is the safest/easiest thing to do for now.

@ragingsquirrel3 ragingsquirrel3 merged commit 830d9eb into aws-amplify:feature/graphql_helpers_updated Nov 11, 2021
@ragingsquirrel3 ragingsquirrel3 deleted the graphql_helpers_nested_decoder branch November 11, 2021 16:31
ragingsquirrel3 pushed a commit that referenced this pull request Nov 15, 2021
* chore(amplify_api): GraphQL helper move dependencies (#729)

* feat(amplify_api): GraphQL helper get query (#742)

* feat(amplify_api): GraphQL Response Decoding (#763)

* feat(amplify_api): GraphQL Query Helper - List  (#771)

* feat(amplify_api): GraphQL Mutate Helper - Create (#778)

* feat(amplify_api): GraphQL Mutate Helper - Update (#779)

* feat(amplify_api): GraphQL Mutate Helper - Delete (#780)

* feat(amplify_api): GraphQL Helpers Integration Tests (#785)

* fix(amplify_api): GraphQL Helper Clean Up (#803)

* graphql helpers: slight refactor to datastore interface QueryFieldOpe… (#962)

* Graphql helpers pagination helpers (#947)

* Graphql helpers: query predicates translated to filters and conditions for GraphQL requests (#973)

* chore(amplify_api): graphql helpers, add parent selection set for models with belongsTo, transform JSON in response for parents and children

* chore(amplify_api): parse nested responses recursively

* chore(amplify_api): make data nullable in graphql responses (#1007)

* chore(amplify_api): graphql helpers, mutations on models with parents (#1004)

* feat(amplify_api): Graphql helpers, include parent and decode nested/parent values (#1055)

Co-authored-by: Elijah Quartey <[email protected]>

BREAKING CHANGE: data field nullable in GraphQLResponse
ragingsquirrel3 pushed a commit that referenced this pull request Jan 26, 2022
* feat(amplify_api): model-based graphql helpers (#1076)

* chore(amplify_api): GraphQL helper move dependencies (#729)

* feat(amplify_api): GraphQL helper get query (#742)

* feat(amplify_api): GraphQL Response Decoding (#763)

* feat(amplify_api): GraphQL Query Helper - List  (#771)

* feat(amplify_api): GraphQL Mutate Helper - Create (#778)

* feat(amplify_api): GraphQL Mutate Helper - Update (#779)

* feat(amplify_api): GraphQL Mutate Helper - Delete (#780)

* feat(amplify_api): GraphQL Helpers Integration Tests (#785)

* fix(amplify_api): GraphQL Helper Clean Up (#803)

* graphql helpers: slight refactor to datastore interface QueryFieldOpe… (#962)

* Graphql helpers pagination helpers (#947)

* Graphql helpers: query predicates translated to filters and conditions for GraphQL requests (#973)

* chore(amplify_api): graphql helpers, add parent selection set for models with belongsTo, transform JSON in response for parents and children

* chore(amplify_api): parse nested responses recursively

* chore(amplify_api): make data nullable in graphql responses (#1007)

* chore(amplify_api): graphql helpers, mutations on models with parents (#1004)

* feat(amplify_api): Graphql helpers, include parent and decode nested/parent values (#1055)

Co-authored-by: Elijah Quartey <[email protected]>

BREAKING CHANGE: data field nullable in GraphQLResponse
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.

5 participants