Skip to content

feat: Remove restrictions for union/either types#761

Merged
Natoandro merged 10 commits intomainfrom
feat/met-402-remove-union-restriction
Jun 28, 2024
Merged

feat: Remove restrictions for union/either types#761
Natoandro merged 10 commits intomainfrom
feat/met-402-remove-union-restriction

Conversation

@Natoandro
Copy link
Copy Markdown
Contributor

In the previous versions, we restricted the variant types allowed in union/either to be all in the same category (after flattening multi-level unions):

  • Category 1 - GraphQL leaf types: scalar type, or array of scalar type, which require no selection set on GraphQL.
  • Category 2 - GraphQL non-leaf types: object type or array of object type, which require a selection set on GraphQL (aka selectable types in the codebase).

Those restrictions can be lifted, and the selection field of an union-type field will have inline fragments with type conditions for each Category 2 variant. No type condition is required for Category 1 types, the selection sets are not relevant.

The case that is not handled by this PR is when one of the variants is an array of union type.

Migration notes

N/A

  • The change comes with new or modified tests
  • Hard-to-understand functions have explanatory comments
  • End-user documentation is updated to reflect the change

@linear
Copy link
Copy Markdown

linear bot commented Jun 20, 2024

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 21, 2024

Codecov Report

Attention: Patch coverage is 84.26230% with 48 lines in your changes missing coverage. Please review.

Project coverage is 73.49%. Comparing base (3ed6e1e) to head (d505cdb).

Files Patch % Lines
typegate/src/engine/typecheck/result.ts 74.39% 21 Missing ⚠️
typegate/src/engine/planner/mod.ts 81.69% 12 Missing and 1 partial ⚠️
typegate/src/typegraph/utils.ts 87.87% 12 Missing ⚠️
typegate/src/typegraph/mod.ts 92.59% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #761      +/-   ##
==========================================
+ Coverage   73.38%   73.49%   +0.10%     
==========================================
  Files         117      117              
  Lines       14145    14195      +50     
  Branches     1409     1421      +12     
==========================================
+ Hits        10381    10432      +51     
  Misses       3738     3738              
+ Partials       26       25       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Natoandro Natoandro requested review from Yohe-Am, destifo, michael-0acf4 and zifeo and removed request for Yohe-Am and destifo June 21, 2024 07:49
Yohe-Am
Yohe-Am previously approved these changes Jun 21, 2024
@Natoandro Natoandro marked this pull request as ready for review June 27, 2024 05:37
@Natoandro Natoandro merged commit 251f128 into main Jun 28, 2024
@Natoandro Natoandro deleted the feat/met-402-remove-union-restriction branch June 28, 2024 13:34
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.

4 participants