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: Add __typename support #871

Merged
merged 1 commit into from
Oct 7, 2022
Merged

Conversation

AndrewSisley
Copy link
Contributor

Relevant issue(s)

Resolves #674

Description

Adds __typename support as per GQL spec.

I think I got all applicable types, but please try have a quick think if there is anything else that I may have missed (collections, groups, commits, commit-links).

I chose to add the prop on the render step, as the field is not targetable (via sort, filter etc) (we may wish to change that at somepoint, but as we dont support gql unions atm I saw no use case for that) and there seemed little point in duplicating the prop across all the documents until last minute.

Specify the platform(s) on which this was tested:

  • Debian Linux

@AndrewSisley AndrewSisley added bug Something isn't working area/query Related to the query component action/no-benchmark Skips the action that runs the benchmark. labels Oct 5, 2022
@AndrewSisley AndrewSisley added this to the DefraDB v0.4 milestone Oct 5, 2022
@AndrewSisley AndrewSisley requested a review from a team October 5, 2022 22:24
@AndrewSisley AndrewSisley self-assigned this Oct 5, 2022
Copy link
Collaborator

@fredcarle fredcarle left a comment

Choose a reason for hiding this comment

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

Looks good. Just a single question.

@@ -13,6 +13,11 @@ Package core provides commonly shared interfaces and building blocks.
*/
package core

import (
"github.com/sourcenetwork/defradb/client"
parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types"
Copy link
Collaborator

Choose a reason for hiding this comment

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

question: There are no conflicts here so why specify a name for the package? types is also shorter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tradition/consistency - parserTypes is used everywhere. I have a minor preference to leaving it as is, but do let me know if you strongly prefer the removal of the alias

Copy link
Collaborator

Choose a reason for hiding this comment

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

I always prefer to avoid aliases unless there is a conflict or if the package name is unwieldy regardless of tradition. But not a strong enough preference to push back if you want to keep it like that. That's why it was only a question.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will leave as is then unless someone else chimes in before the build completes

As per GQL spec
@codecov
Copy link

codecov bot commented Oct 7, 2022

Codecov Report

Merging #871 (f3d5d14) into develop (f9747f1) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #871      +/-   ##
===========================================
+ Coverage    59.79%   59.83%   +0.04%     
===========================================
  Files          157      157              
  Lines        17425    17443      +18     
===========================================
+ Hits         10419    10437      +18     
  Misses        6068     6068              
  Partials       938      938              
Impacted Files Coverage Δ
core/doc.go 94.21% <100.00%> (+0.63%) ⬆️
query/graphql/mapper/mapper.go 85.22% <100.00%> (+0.09%) ⬆️

@AndrewSisley AndrewSisley merged commit 398fe03 into develop Oct 7, 2022
@AndrewSisley AndrewSisley deleted the sisley/fix/I674-type-name branch October 7, 2022 15:46
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/no-benchmark Skips the action that runs the benchmark. area/query Related to the query component bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support GraphQL type name introspection
2 participants