tailcall icon indicating copy to clipboard operation
tailcall copied to clipboard

Prefer Inferred Types over unknown types While Merging When Two Types Have Similar Fields

Open amitksingh1490 opened this issue 1 year ago • 6 comments

Issue Description

When merging types in the generated GraphQL config, if two types have exactly similar fields but differ only by unknown (empty) types, the known type should be given preference. Enable this behavior, configurable via a flag.

Example:

Given the following types:

type A {
  brand: String
  discountApplicable: Boolean
  id: String
  imported: Boolean
  minimumRequiredAge: Int
  name: String
  pharmaceuticalInfo: Empty
  primarySubcategoryId: String
}

type B {
  brand: String
  discountApplicable: Boolean
  id: String
  imported: Boolean
  minimumRequiredAge: Int
  name: String
  pharmaceuticalInfo: Empty
  primarySubcategoryId: Empty
}

Current Behavior:

  • The types A and B are treated as distinct types due to the presence of Empty fields.

Expected Behavior:

  • Types A and B should be merged, giving preference to known types over Empty.

Requested Feature:

  • Add a flag to enable inferring types while merging, with preference for known types over Empty.
  • The feature should be configurable via a flag in the configuration file.

amitksingh1490 avatar Jul 28 '24 12:07 amitksingh1490

/bounty 75$

amitksingh1490 avatar Jul 28 '24 12:07 amitksingh1490

💎 $75 bounty • Tailcall Inc.

Steps to solve:

  1. Start working: Comment /attempt #2560 with your implementation plan
  2. Submit work: Create a pull request including /claim #2560 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

🙏 Thank you for contributing to tailcallhq/tailcall! 🧐 Checkout our guidelines before you get started. 💵 More about our bounty program.

Attempt Started (GMT+0) Solution
🔴 @ssddOnTop Jul 28, 2024, 12:26:54 PM WIP
🟢 @laststylebender14 #2567

algora-pbc[bot] avatar Jul 28 '24 12:07 algora-pbc[bot]

/attempt #2560

Algora profile Completed bounties Tech Active attempts Options
@ssddOnTop 67 tailcallhq bounties
Rust, Java,
C & more
Cancel attempt

ssddOnTop avatar Jul 28 '24 12:07 ssddOnTop

💡 @laststylebender14 submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] avatar Jul 28 '24 16:07 algora-pbc[bot]

@ssddOnTop: Reminder that in 1 days the bounty will become up for grabs, so please submit a pull request before then 🙏

algora-pbc[bot] avatar Jul 29 '24 12:07 algora-pbc[bot]

The bounty is up for grabs! Everyone is welcome to /attempt #2560 🙌

algora-pbc[bot] avatar Jul 30 '24 12:07 algora-pbc[bot]

🎉🎈 @laststylebender14 has been awarded $75! 🎈🎊

algora-pbc[bot] avatar Aug 28 '24 15:08 algora-pbc[bot]